The expenses included a $650 million settlement with American International Group and money it set aside for an expected settlement with the Department of Justice. Bank of America has already agreed to pay $50 billion to settle disagreements stemming from the market meltdown in 2008.

The bank's shares fell 1.9 percent to $15.50 in early afternoon trading.

The expenses far exceeded the $471 million in legal charges the bank posted in last year's second quarter, although it was less than the $6 billion it recorded in this year's first quarter.

Higher legal costs overshadowed the increased profits that many of the bank's main businesses posted. Retail banking earnings, including credit cards, rose 28.5 percent to $1.79 billion. Commercial and investment banking profit rose 4.3 percent to $13.5 billion, thanks in part to a record quarter in underwriting equities.

"The sins are seven years old and the things that are going on in the future look bright," said Bill Smead, chief investment officer of Smead Capital Management, a Seattle-based investment firm that owns around 2.6 million shares in Bank of America.

Sales and trading profit jumped 14.44 percent to $1.1 billion, helped by a 5 percent increase in revenue in bond trading to $2.4 billion, excluding an accounting adjustment. Higher revenues in trading corporate, mortgage and municipal bonds help Bank of America avoid the double-digit declines in bond trading that rivals JPMorgan Chase & Co JPM.N and Citigroup Inc C.N experienced.

The second-largest U.S. bank said on Wednesday that earnings for common shareholders fell to $2.04 billion, or 19 cents per share, in the three months ended June 30 from $3.58 billion, or 32 cents per share, a year earlier.

Analysts on average had expected earnings of 29 cents per share, according to Thomson Reuters I/B/E/S. It was not immediately clear which expenses should be excluded from the bank's results to most directly compare to estimates, but the posted results fell short of the average forecast, Thomson Reuters I/B/E/S said.

STANDOFF WITH JUSTICE DEPT

Bank of America has been negotiating a multibillion dollar settlement with the Department of Justice to resolve investigations into the sale of mortgage-backed bonds.

A person familiar with the matter said that Bank of America representatives, including general counsel Gary Lynch, met with Justice Department lawyers on Tuesday, but no progress was made towards a deal. The person is not authorized to speak publicly.

The bank has offered to settle for about $12 billion, while the Justice Department has suggested $17 billion, sources familiar with the matter have said.

The Wall Street Journal reported on Wednesday that Bank of America had offered to settle for $13 billion, but did not say when that offer was made. The bank declined to comment on the report.

After the settlement with AIG and others, "we feel like we have gotten a large chunk of this behind us," said Bank of America Chief Financial Officer Bruce Thompson on a conference call with reporters.

He added that, "clearly, the DoJ is the most significant matter out there that is remaining."

(Reporting by Tanya Agrawal and Peter Rudegeair; Additional reporting by Aruna Viswanatha; Editing by Ted Kerr and Phil Berlowitz)

By Peter Rudegeair and Tanya Agrawal