Capmark Financial Group Inc., the commercial real estate company created through a 2006 leveraged buyout of certain GMAC assets, is preparing to file for bankruptcy possibly by the end of next week, according to a source with direct knowledge of the situation.

The company, which owns a bank that will continue to operate while it is in court, is in negotiations with lenders, bondholders and the Federal Deposit Insurance Company that will result in a filing by the end of October at the latest, the source said.

They are working on details of a debt-for-equity swap that will take place to bring the company back out of bankruptcy, he said. It is not certain how long the court process could take.

Capmark was not immediately available for comment.

Last month, Capmark 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.

Capmark, which has been in debt restructuring talks for many months, is being pushed to bankruptcy court by a deterioration in the commercial real estate market and its outlook over the last three months, the source said.

Kohlberg Kravis Roberts & Co , Goldman Sachs Group and Five Mile Capital, which bought Capmark in March 2006 for $1.5 billion in cash plus more than $7 billion in debt at the peak of the housing market, will not receive payment through the bankruptcy.

The source said the company will belong to its creditor group, which is made up of more than 50 banks and more than 50 hedge funds among others. The lead banks are Citigroup's Citibank and JPMorgan Chase .

They are negotiating a pre-arranged bankruptcy, for which Capmark needs approval from two-thirds of their creditors. But Capmark will file this month even if it does not get that support to meet the terms of a $490 million asset sale to a group including Warren Buffett, the source said.

Capmark agreed to sell its loan servicing and mortgage business to Berkshire Hathaway and Leucadia National for $490 million. In that September 2 agreement, Capmark purchased a contract, or put, for $40 million giving it the right to sell them the business. That put expires within 60 days - around November 2 - unless the company files for bankruptcy.

In bankruptcy, Buffett's group will essentially be the stalking horse setting the floor in a so-called 363 asset sale bidding for the assets, and the put is extended.

It will use the funds from that sale to help shore up Capmark Bank, which is based in Utah and has about $10 billion in assets, the source said. The company has already added about $900 million in capital to the bank.

After emerging from bankruptcy, Capmark will likely be wound down during five or more years as the owners wait for a better market to sell most of the assets, the source said.

The filing will be another red mark for General Motors', which was in bankruptcy court itself earlier this year. It opened GMAC - known as the General Motors Acceptance Corporation - to do auto financing - but expanded into both commercial and residential real estate over the years.

Capmark, based in Horsham, Pennsylvania, has three main commercial real estate businesses: lending and mortgage banking, investments and funds management and servicing. It had more than $288 billion in commercial real estate loans as of June 30.

The company has about $20 billion in liabilities, of which about $10 billion are at Capmark Bank. It has about $8 billion in debt at the holding company level that is associated with the leveraged buyout.

(Editing by Anshuman Daga)

(caroline.humer@thomsonreuters.com; 1 646 223-6181))