Citigroup has agreed to pay $285 million to settle civil fraud charges that it misled buyers of complex mortgage investments just as the housing market was starting to collapse.

The Securities and Exchange Commission said Wednesday that the big Wall Street bank bet against the deal in 2007 and made $160 million in fees and profits. Investors lost millions.

Citigroup neither admitted nor denied the SEC’s accusations in the settlement, saying in a statement it was “pleased to put this matter behind us and are focused on contributing to the economic recovery, serving our clients and growing responsibly.”

The penalty is the biggest involving a Wall Street firm accused of misleading investors before the financial crisis since Goldman Sachs & Co. paid $550 million to settle similar charges last year. JPMorgan Chase & Co. resolved similar charges in June and paid $153.6 million.

All the cases have involved complex investments called collateralized debt obligations. Those are securities that are backed by pools of other assets, such as mortgages.

Citigroup’s payment includes the fees and profit it earned, plus $30 million in interest and a $95 million penalty. The money will be returned to the investors, the SEC said.

In the July-September quarter, Citigroup earned $3.8 billion. CEO Vikram Pandit this year was awarded a multiyear bonus package that could be worth nearly $23.4 million if performance goals are met.

At the height of the financial crisis in 2008, regulators worried that Citigroup was on the brink of failure. It received $45 billion as part of the $700 billion government bailout.

In the civil lawsuit filed Wednesday, the SEC said Citigroup traders discussed in late 2006 the possibility of buying financial instruments to essentially bet on the failure of the mortgage assets being assembled in the deal.

Rating agencies downgraded most of the investments that Citigroup had bundled together just as many troubled homeowners stopped paying their mortgages in late 2007. That pushed the investment into default and cost its buyer’ - hedge funds and investment managers - several hundred million dollars in losses.

Among the biggest losers were Ambac, a bond insurer, and BNP Paribas, a European bank. Ambac had sold Citigroup protection against losses on the investment, allowing Citigroup to bet against it.

Hedge funds had asked Citigroup to sell them investments that would decline if the housing market crashed. Citigroup did so and wanted to get in on the action, the SEC said.

Citigroup bet that the investments would fail, but never told investors it had done so, SEC enforcement chief Robert Khuzami said in a conference call.

“Key facts regarding how the structure was put together were not made available to [investors], and they suffered losses as a result,” he said.