Warren Buffett's Berkshire Hathaway Inc and Leucadia National Corp agreed to buy Capmark Financial Group Inc's mortgage loan and servicing business for as much as $490 million, increasing exposure to a possible U.S. housing recovery.

Capmark also said it may file for Chapter 11 bankruptcy protection after soured loans left it with a $1.62 billion second-quarter loss. It said stockholders had negative equity of $1.14 billion as of June 30.

According to a May 5 report by Moody's Investors Service, Horsham, Pennsylvania-based Capmark is one of the largest U.S. commercial real estate finance companies, with more than $10 billion of originations in 2008 and a servicing portfolio exceeding $360 billion.

In a statement, Capmark said it paid a Berkshire-Leucadia joint venture, Berkadia III LLC, $40 million to enter the mortgage asset sale agreement.

It said that if a sale occurs through the bankruptcy process, Berkadia will pay $415 million in cash and receive a $75 million note. If it occurs outside bankruptcy, Berkadia would pay $375 million in cash and get the $75 million note, and retain a $40 million holdback to cover indemnity claims.

Berkshire is adding real estate exposure following a three-year housing downturn that has shown some signs of easing. It is also the largest investor in Wells Fargo & Co , the nation's largest mortgage lender.

On Tuesday, Berkshire's real estate brokerage, HomeServices of America Inc, said it bought the Chicago-based agency Koenig & Strey GMAC Real Estate from a unit of Canada's Brookfield Asset Management Inc for an undisclosed price.

Berkshire spent about $6.27 billion on acquisitions in the year-and-a-half ended June 30, 2009. Buffett prefers to acquire companies with easy-to-understand businesses, consistent earnings power, strong management and little or no debt.

Since 1965, Buffett has built Omaha-based Berkshire into a conglomerate with close to 80 businesses that sell such things as car insurance, ice cream, paint and underwear, and more than $112 billion of investments. Leucadia, based in New York, has investments in several industries.

Berkshire Class A shares closed Wednesday down $400 at $98,200 on the New York Stock Exchange.

(Reporting by Jonathan Stempel, editing by Leslie Gevirtz)