Bank of America has agreed to pay a record $16.7bn (£10bn) to US authorities for misleading investors about the quality of loans it sold.
The loans were sold by Countrywide Financial and Merrill Lynch before Bank of America bought them in 2008, at the height of the financial crisis.
The associate attorney general said "no institution is either too big or too powerful to escape" punishment.
The settlement will cut the bank's third-quarter profits by $5.3bn.
Bank of America will pay a total of $9.65bn in cash and provide consumer relief worth about $7bn, much of which will go towards homeowners struggling with their mortgages.
The cash component consists of a $5bn civil penalty and $4.63 billion in compensation payments.
The case centred on Countrywide Financial, the biggest lender at the time of the crisis, and Merrill Lynch selling mortgage loans to investors but not explaining the full extent of the risk involved.
Tony West, the associate attorney general, explained: "It's kind of like going to your neighbourhood grocery store to buy milk advertised as fresh, only to discover that store employees knew the milk you were buying had been left out on the loading dock, unrefrigerated, the entire day before, yet they never told you.
"And just like you might be in for an unpleasant surprise when you got home and poured yourself that glass of milk, investors - such as public pension funds and federally-insured financial institutions - were unpleasantly met with billions of dollars in losses when those securities investments soured."
Brian Moynihan, chief executive of the bank, said: "We believe this settlement, which resolves significant remaining mortgage-related exposures, is in the best interests of our shareholders, and allows us to continue to focus on the future."
Analysis: Michelle Fleury, BBC New York
This is the latest effort by authorities in the US to hold Wall Street accountable for the bad conduct that led to the financial crisis.
And the sums involved in Bank of America's settlement dwarf the $13bn paid by another bank, JP Morgan to resolve a similar matter.
Even though the penalty exceeds Bank of America's entire profits last year, this deal brings a measure of closure.
The bank, one of America's biggest, has already paid tens of billions of dollars to settle cases related to the financial crisis but this was seen as the biggest remaining legal hurdle.
On Wall Street, shares in Bank of America opened 1.5% higher following the settlement.
Joel Conn, president of investment firm Lakeshore Capital, said it was because a "major cloud [hanging over the bank] has been lifted"
"Regulators wanted a pound of flesh, and they got it," he added.
Previously, the largest banking fine by US regulators was a $13bn settlement reached with JPMorgan in 2013, for misleading investors during the housing crisis.
The Bank of America fine is the latest in a line of penalties imposed by the US on banks since the 2008 financial crisis.
In March this year Bank of America agreed to pay $9.5bn to settle charges that it misled US mortgage lenders Fannie Mae and Freddie Mac over mortgage securities.
In June, French bank BNP Paribas was fined $9bn for violating US sanctions on Iran, Sudan and other countries.