(Reuters) -- Bank of America Corp was the fourth-biggest U.S. mortgage lender in the fourth quarter of 2011, continuing its descent in the rankings after it stopped buying loans made by smaller banks.

The second-largest U.S. bank in 2008 became the biggest mortgage originator after buying Countrywide Financial, but it has been gradually paring back the business as it copes with losses from the disastrous acquisition.

Citigroup Inc moved ahead of Bank of America in the fourth quarter, with about $23 billion in mortgage loans, slightly ahead of Bank of America's $22.4 billion in loans, according to data released Thursday by industry publication Inside Mortgage Finance.

Wells Fargo & Co remained the largest mortgage originator by far, making $120 billion in loans. That meant it made 30 percent of all loans in the quarter, up from about 27 percent in the third quarter.

JPMorgan Chase & Co was the second-biggest lender in the quarter, with about $42 billion in loans.

In October, Bank of America said it was exiting correspondent lending by year's end, stripping out about half of its production as it focused on making loans directly to its own customers. The bank now has about 6 percent market share, less than the 7.8 percent it held in 2007 before buying Countrywide.

That acquisition, which brought to the banks loads of bad loans and related lawsuits, has not worked out on two fronts for Bank of America, said Guy Cecala, publisher of Inside Mortgage Finance.

"Not only are they looking to abandon the servicing side of the business, they're looking to abandon the origination platform," he said.

While the bank is missing out on newer loans made under stricter underwriting standards, decreasing its profile in the mortgage business is likely good for its stock price, he said. "It will be welcomed by shareholders and analysts," Cecala said.

After falling 58 percent in 2011, Bank of America's shares are up more than 30 percent this year.

In a CNBC interview Wednesday at the World Economic Forum in Switzerland, Bank of America Chief Executive Officer Brian Moynihan said exiting the correspondent business was a good move because the company was no longer providing its balance sheet to other banks' customers.

"We've shaped our mortgage business much smaller," he said. "We've really got it back (to) our core retail customer... We'll continue to do that."

(Reporting By Rick Rothacker; Editing by Maureen Bavdek, Gary Hill)