By James Sterngold, Dan Fitzpatrick and Nick Timiraos 

Bank of America Corp. and former Chief Executive Kenneth Lewis took big steps to put the financial crisis behind them by paying state and federal agencies to settle lawsuits over the acquisitions of Countrywide Financial Corp. and Merrill Lynch & Co.

The Charlotte, N.C., lender said Wednesday that it would pay $9.5 billion to settle mortgage claims with Fannie Mae, Freddie Mac and their federal regulator.

Bank of America also agreed to pay the state of New York $15 million to end a civil lawsuit by New York state Attorney General Eric Schneiderman alleging the bank duped shareholders by failing to disclose mounting losses at Merrill before buying the securities firm in a rushed deal struck in 2008 near the height of the financial crisis. The bank neither admitted nor denied wrongdoing in both settlements.

Mr. Lewis agreed to pay $10 million and accept a three-year ban from work at any public company as part of the New York settlement. Bank of America will cover Mr. Lewis's penalty, according to people familiar with the deal. Mr. Lewis neither admitted nor denied wrongdoing.

Bruce Yannett, Mr. Lewis's lawyer, said the former CEO "is proud of the role he played in helping the U.S. banking system survive" but that he "is pleased to put this matter behind him and to move on with his life."

The settlements bring to more than $60 billion Bank of America's legal tab for its acquisitions of Countrywide and Merrill.

The agreements represent the latest attempt by the second-largest U.S. bank by assets to move past its financial-crisis-era legal problems. Bank of America still faces investigations by the Justice Department, states and a government fraud task force over its sales of flawed mortgage bonds during the run-up to the housing-market bust.

Bank of America's settlement with the Federal Housing Finance Agency is the largest to stem from 18 lawsuits filed by the regulator three years ago, seeking recoveries on more than $200 billion in mortgage-backed securities purchased by Fannie and Freddie. The bank said the pact is expected to reduce its first-quarter net income by $3.7 billion, or 21 cents a share.

The FHFA sued Bank of America along with Countrywide and Merrill in 2011, seeking unspecified losses on $57.4 billion in mortgage-backed securities. The FHFA had alleged that Bank of America and its affiliates misrepresented the quality of loans underlying those bonds.

The FHFA has now settled 12 lawsuits, collecting $19.1 billion for Fannie and Freddie.

As part of the deal, Bank of America will repurchase securities with fair market value of about $3.2 billion, and it will pay the balance of the settlement, roughly $6.3 billion, in cash.

Mr. Lewis stepped down in 2009 but has faced a barrage of litigation since then. He and other Bank of America directors earlier agreed to pay $62.5 million as part of a settlement of a civil lawsuit by investors that also claimed they failed to disclose necessary information about Merrill before they approved the takeover.

Bank of America in 2012 agreed to pay $2.43 billion to settle a class-action lawsuit with a group of investors that alleged the bank and its officers made false or misleading statements about Merrill's health. In 2010, it agreed to pay $150 million in a settlement with the Securities and Exchange Commission because of its failure to disclose material information about Merrill. The bank neither admitted nor denied wrongdoing in these earlier settlements.

The Merrill acquisition, struck the same September 2008 weekend that Lehman Brothers Holdings Inc. tumbled into bankruptcy, was hailed as a rare piece of good news when much of Wall Street appeared to be teetering on the brink. The deal, priced initially at $50 billion, vaulted Bank of America to the top of the U.S. banking heap, a goal that Mr. Lewis and his predecessor, Hugh McColl, had pursued over two decades.

But the agreement soon became a problem, as analysts questioned whether Mr. Lewis paid too much and as Merrill's losses snowballed in the weeks before the deal closed.

Mr. Lewis and his top executives made the decision not to say anything publicly about the problems before shareholders signed off on the merger, a decision that formed the basis of a number of Merrill-related suits.

Joe Price, the bank's former chief financial officer, was included in the New York attorney general's suit but declined to settle. Mr. Schneiderman plans in April to ask a judge to make a ruling that Mr. Price be banned permanently from working at or serving as a director of a public company, said a spokesman for the attorney general.

A lawyer for Mr. Price, William H. Jeffress Jr. of Baker Botts, said, "The bank and Ken are not admitting or denying anything as part of their settlement but they are accepting certain relief. Joe made a different decision and we will continue to defend the case."

The legal scrutiny surrounding the Merrill acquisition contributed to Mr. Lewis's decision to step down at the end of 2009. One headache was a yearlong investigation led by then-New York Attorney General Andrew Cuomo that resulted in a 2010 lawsuit against the bank, as well as Mr. Lewis. The bank tried to reach a settlement with Mr. Cuomo before the suit was filed, but talks broke down.

For years, Mr. Lewis told friends he intended to fight the attorney general's suit because of his view that he did nothing wrong. In recent months, though, Mr. Lewis changed his mind because, at 67 years old, he worried that a long legal battle would cost him precious years, said a person familiar with his thinking. His wife also was an advocate for putting the matter behind them, this person said.

"These were among the most turbulent financial times in American history, " said a Bank of America spokesman. "Not only was Merrill Lynch kept alive but it has prospered since joining Bank of America."

After Mr. Lewis left Bank of America, he spurned offers from other companies to become a public director. He now divides his time between homes in Florida and North Carolina and trips to California to see members of his family.

Write to James Sterngold at james.sterngold@wsj.com, Dan Fitzpatrick at dan.fitzpatrick@wsj.com and Nick Timiraos at nick.timiraos@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires