Bank of America Corp. has agreed to pay nearly $17 billion in a settlement with federal regulators over allegations that it misled investors into buying risky, mortgage-backed securities in the run-up to the 2008 financial meltdown.

The Department of Justice, which announced the $16.65 billion deal today, describes it as "the largest civil settlement with a single entity in history."

BofA, the second-largest U.S. bank, will pay a $9.65 billion penalty and provide $7 billion in relief to troubled borrowers, Reuters reports. The bank says it's expecting a $5.3 billion hit to third-quarter earnings as a result of the deal.

The settlement "addresses allegations that Bank of America, Merrill Lynch and Countrywide each engaged in pervasive schemes to defraud financial institutions and other investors in structured financial products known as residential mortgage-backed securities, or RMBS," U.S. Attorney General Eric Holder said.

The securities typically included a high percentage of subprime mortgages, and the sellers misrepresented to investors the degree of risk involved, Justice alleges. When the housing market collapsed, many of the RMBS became worthless.

Holder said the subprime mortgages bundled into the securities "contained material underwriting defects; they were secured by properties with inflated appraisals; they failed to comply with federal, state, and local laws; and they were insufficiently collateralized."

Even so, he said, "these financial institutions knowingly, routinely, falsely, and fraudulently marked and sold these loans as sound and reliable investments. Worse still, on multiple occasions — when confronted with concerns about their reckless practices — bankers at these institutions continued to mislead investors about their own standards and to securitize loans with fundamental credit, compliance, and legal defects."

Countrywide, acquired by the Charlotte, N.C.-based Bank of America in the wake of the 2008 financial collapse, accounts for most of the alleged wrongdoing. BofA also owns Merrill Lynch.

The settlement is the latest in a series prompted by the Justice Department actions. In November, JPMorgan Chase agreed to pay $13 billion, and in July, Citigroup came to a $7 billion deal with the federal investigators.

But, as TheNew York Times writes: "More than any other Wall Street giant, Bank of America was the source of the troubled subprime loans that helped ignite the crisis."

The Times says that while no bank executives will face charges as part of the agreement, "prosecutors are preparing a separate civil case against [former Countrywide CEO] Angelo Mozilo, the man who came to embody the risk-taking for which Bank of America is now paying dearly, a rare move against a senior executive at the center of the financial crisis."

The newspaper says Mozilo's company "originated mortgages that went to people with little income to repay them, causing devastating losses for investors who bought the loans."

Copyright 2016 NPR. To see more, visit