The judge characterized the $33 million fine as “strangely askew” given the accusations made, the magnitude of Merrill’s losses and the subsequent bailout for Bank of America. The judge questioned the role of top executives at the companies, in particular Mr. Lewis and John A. Thain, the former chief executive of Merrill Lynch, both of whom signed off on a proxy statement to investors.

Image Judge Jed Rakoff withheld approval of the S.E.C.-Bank of America deal. Credit... Fred R. Conrad/The New York Times

“Was there some sort of ghost that performed those actions?” Judge Rakoff said.

The S.E.C.’s complaint focused on a document that detailed the bonuses, but which was not included in the merger agreement or proxy statement that was sent to the companies’ shareholders, who voted to approve the merger on Dec. 5.

The S.E.C.’s lawyer, David Rosenfeld, said repeatedly during the hearing Monday that the agency had chosen not to make allegations against individuals in the case.

Mr. Rosenfeld spoke softly and was called up to the microphone after Judge Rakoff criticized the S.E.C. for the evidence it had presented  or failed to. The judge said the commission was remiss for not determining who at the companies decided not to disclose the bonus agreement. And he suggested that they should have interviewed the external lawyers for both companies.

“You filed a rather uninformative, bare-bones complaint,” Judge Rakoff said.

Lewis J. Liman, a lawyer representing Bank of America, told the judge, when prodded, that the bank believed it had not wronged its shareholders. Mr. Liman, son of Arthur L. Liman, the lawyer who led the Iran-contra investigation in the Senate, seemed at times dismissive, saying at one point: “My God! Bonuses on Wall Street? It is not a matter of surprise.”

Merrill had little choice but to pay many of the bonuses, Mr. Liman said. Of the $3.6 billion, Merrill had committed $850 million in the form of guaranteed bonuses. Mr. Liman said the rest of the money was shared among 39,000 workers who received average payments of $91,000  though he did not mention that there were 696 people at Merrill who made more than $1 million in bonuses.