Bank of America has reached a $16.65 billion settlement with US regulators to settle charges that it misled investors into buying troubled mortgage-backed securities. 

The settlement announced today by the US Department of Justice calls for the second-largest US bank to pay a $9.65 billion cash penalty, and provide $7 billion of consumer relief to struggling homeowners and communities. 

It is expected to resolve the vast majority of the Charlotte, North Carolina-based bank's remaining liabilities tied to its purchases of Countrywide Financial Corp, once the largest mortgage lender in the US, and Merrill Lynch & Co. 

"This historic resolution - the largest such settlement on record - goes far beyond 'the cost of doing business,'" US Attorney General Eric Holder said in a statement.

Bank of America said the accord is expected to reduce third-quarter earnings by about $5.3 billion before taxes, or about 43 cents a share after taxes. 

The bank's chief executive Brian Moynihan has spent over four years trying to rid Bank of America of liabilities from the purchases of Countrywide and Merrill, which were made by his predecessor, Kenneth Lewis. 

In a statement today, Moynihan said the accord is in shareholders' best interests. 

The settlement details had surfaced earlier this month, and the formal announcement may increase the chance that many of the bank's mortgage problems are behind it. 

Bank of America admitted having sold billions of dollars of risky mortgage-backed securities while concealing key facts about the quality of the underlying loans.

It also admitted to having made misrepresentations to Fannie Mae and Freddie Mac about the quality of loans sold to those government-controlled mortgage companies. 

The settlement resolves pending and potential future cases by the Justice Department, the Securities and Exchange Commission, the Federal Deposit Insurance Corporation, the Federal Housing Administration and several US states. 

It does not cover the $1.27 billion fraud penalty imposed last month by a federal judge over a fraudulent Countrywide mortgage scheme known as "High Speed Swim Lane," or "Hustle," which Bank of America is appealing. 

The accord also does not cover potential criminal claims or claims against individuals. 

Including the latest settlement, Bank of America will have paid well over $65 billion to resolve mortgage issues with consumers, investors and government agencies tied to its purchase of Countrywide in July 2008 and Merrill six months later. 

The $16.65 billion settlement eclipses the respective $13 billion and $7 billion accords that JPMorgan Chase & Co and Citigroup recently reached to resolve similar claims.