In a blistering ruling, a federal bankruptcy judge ordered Bank of America to repay $500 million it seized from a collateral account after Lehman filed for Chapter 11 protection.