Bank of America Corp, the largest U.S. bank, reported weaker-than-expected revenue and a second straight quarterly loss after its limping mortgage business triggered writedowns and legal settlements.

Bank of America's Merrill Lynch businesses -- including retail brokerage and investment banking -- were profitable but did not make enough money to overcome the bank's massive losses from mortgages.

As the financial crisis was ramping up, then Chief Executive Kenneth Lewis bought Countrywide Financial Inc for $4.2 billion. Current CEO Brian Moynihan is still coping with the aftermath.

In the fourth quarter, Bank of America took a writedown of $2 billion to recognize the declining value of Countrywide. The bank also set aside $4.1 billion for legal costs linked to home loans it is buying back from investors, or is likely to buy back.

Countrywide is still hurting them and it will continue to. It's like a tooth being pulled -- it's only going to feel good when it's done, said Matt McCormick, portfolio manager at Bahl & Gaynor Investment Counsel Inc in Cincinnati, which does not own Bank of America shares.

It was not clear how Bank of America's results compared with analysts' average estimates, given the profusion of special items in the report.

Bank of America is the only major bank this week to post a fourth-quarter loss, and it missed on analysts' revenue estimates. The bank posted revenue of $22.7 billion, below an expected $24.9 billion and its third straight quarterly decline. Revenue shrank 11 percent from a year ago.

The company's home loan business has lost more than $12 billion in the last two years. Chief Financial Officer Charles Noski said on a conference call that the bank may have to set aside another $7 billion to $10 billion to cover legal settlements with mortgage investors.

CEO Moynihan, speaking on financial news network CNBC, said the U.S. housing market would continue to bump along the bottom, and the banking industry would be dealing with related problems for years to come.

The bank's shares closed down 2 percent at $14.25 on the New York Stock Exchange, lagging the KBW Bank Index, which rose 1.6 percent.

Bank of America is relatively cheap compared with other bank stocks. It trades at about 1.1 times tangible book value, below the bank industry's average multiple of 1.6, said Alan Villalon, analyst at Nuveen Asset Management in Minneapolis. Nuveen Asset Management owns shares of bank stocks, including Bank of America.

Citigroup Inc's stock trades at 1.09 times tangible book value, while Goldman Sachs trades at 1.39 times.

Moynihan, during a fourth-quarter conference call with analysts, said the company's stock underperformed in 2010, and return on equity and on assets was below where management wanted it to be.

Bank of America shares declined 11.4 percent during 2010, closing at $13.34 per share on December 31.

OUTLOOK

Despite the tough mortgage environment, Moynihan said on the conference call that he remained optimistic about the U.S. economy in 2011. All of the bank's measures of consumer and business spending show positive trends, he said.

Moynihan also said the bank plans to raise its dividend in the second half of 2011 if it passes the Federal Reserve's second stress test. The bank slashed its quarterly dividend to 1 cent per share at the height of the financial crisis after receiving $45 billion of U.S. government aid.

The 19 largest U.S. banks are being tested by the Fed, with results expected later this spring. CFO Noski told Reuters the Fed was splitting the banks into two groups on the basis of when they wanted to raise dividends.

Mortgages are hurting Bank of America, but financial regulation could also weigh on future results, bank officials said.

Noski said a new law limiting the fees that big banks can charge merchants for processing debit card transactions could cost Bank of America $1 billion of revenue starting in the second half of 2011.

Although the bank has suffered from its Countrywide purchase, its acquisition of Merrill Lynch has helped.

Bank of America's global banking and markets unit, combined with its global wealth and investment management arm, which includes Merrill Lynch's investment bank operations and retail brokerage, earned $1.06 billion in the fourth quarter.

Merrill worked out much better than you would have thought, said Mike Holland, founder of Holland & Co, which oversees more than $4 billion of assets.

CHARGES WEIGH

The fourth quarter was the second straight quarter to include large one-time charges for the bank, and pushed it to a second straight quarterly loss after two consecutive quarterly profits in Moynihan's first year as CEO.

In the third quarter, the bank reported a $10 billion writedown of its cards business due to new curbs on debit card fees.

Moynihan is trying to turn around a bank cobbled together by Lewis primarily through acquisitions over the last decade. Moynihan is a former FleetBoston executive, a bank that BofA bought in 2003.

BofA's most profitable division in the fourth quarter, its cards unit, was built mainly by the purchase of Delaware-based credit card giant MBNA Corp in 2005 for $35 billion.

While the bank's credit costs continue to shrink -- nonperforming loans declined 8.6 percent from a year earlier to $32.6 billion in the fourth quarter -- revenue is also declining.

Despite the shrinking revenue, the bank posted loan growth of 0.7 percent compared with the third quarter, rising to $940 billion.

The bank reported a fourth-quarter shareholder loss of $1.57 billion, or 16 cents a share, compared with a loss of $5.2 billion, or 60 cents a share, a year earlier.

Excluding the mortgage business writedown, the bank earned $756 million, or 4 cents per share.

Analysts had expected earnings of 14 cents per share, according to Thomson Reuters I/B/E/S.

(Editing by John Wallace and Steve Orlofsky)