Some of the billions of dollars the U.S. government paid to bail out American International Group Inc stand to benefit hedge funds that bet on a falling housing market, the Wall Street Journal said, citing people familiar with the matter and reviewed documents.

AIG has put in escrow some money for at least one major bank, Deutsche Bank AG , whose hedge fund clients bet against the housing market, the paper said, citing a person familiar with the matter.

The money will be released to the bank if mortgage defaults rise above a certain level, it said.

Investment banks such as Goldman Sachs Group Inc and Deutsche Bank sold financial instruments to hedge funds letting them bet that mortgage defaults would rise, the paper said, adding that the instruments were credit default swaps -- a form of insurance that pays out in the event of a debt default.

From mid-September to the end of last year, AIG and the government paid $5.4 billion to Deutsche and $8.1 billion to Goldman under credit default swap contracts the insurer had written, the paper said.

It is not known which hedge funds made those bets with specific banks, the paper said, adding several large funds made big, ultimately profitable, wagers that mortgage defaults would increase.

An AIG spokeswoman declined to comment to the paper.

A spokesman for Deutsche Bank told the paper that the bank's exposure to AIG was well-collateralized and hedged.

A Goldman spokesman also told the paper that the firm's exposure was collateralized and hedged.

AIG, Deutsche Bank and Goldman Sachs could not be immediately reached for comment by Reuters.

AIG, an embattled insurance giant that has received federal bailouts totaling $173 billion and is now paying $165 million in employee bonuses, is at the heart of a global financial crisis that U.S. President Barack Obama is trying to address with plans for trillions of dollars in spending.

(Reporting by Ajay Kamalakaran in Bangalore, Editing by Ian Geoghegan)