The Federal Crisis Inquiry Commission (FCIC) found that Goldman Sachs (NYSE: GS) collected nearly $3 billion in bailout money that was given to American International Group (NYSE: AIG) for derivatives trades that it made with AIG.

The FCIC disclosed that $2.9 billion went directly into Goldman’s coffers instead of to its clients, in a report that it issued today on the financial bailout in 2008.

Goldman is now the most profitable institution on Wall Street, as it has netted about $22 billion in profits over the past two years.

The development is important because in 2009, Goldman executives testified before Congress that the $14 billion in bailout money it received from AIG went towards compensating its clients, who bought mortgage-backed bonds from Goldman.

According to the FCIC report, Goldman sold bonds backed directly by the subprime mortgage market to investors, and then – for its own benefit – bought credit default swap (CDS) protection -- essentially, insurance for bondholders -- on those bonds from AIG. AIG, however, did not have enough liquidity to back up the insurance that it sold in the form of CDS contracts.

In 2008, AIG was said to be holding the bag on $187 billion for mortgage-backed bond insurance that it had sold to clients between 2000 and 2008. Put simply, AIG was like an insurance company that sold policies to New Orleans homeowners in 2004 without believing that Hurricane Katrina was about to hit the Gulf Coast.

AIG needed bailout money in large part to back up the bond insurance that it had sold, but the bailout money was said to have been given to Goldman’s clients, rather than to Goldman itself.

In a credit default swap agreement, a bond holder, in exchange for a fee, gets both credit and default protection from a counterparty. Put simply, it’s a transaction that’s akin to Person B proposing to Person A that, in exchange for a small monthly fee, Person B guarantees to pay the full balance of Person A’s credit card in the event that Person A cannot pay the full card balance.

Financial institutions such as AIG apparently did not figure that many of the mortgage-backed bonds that it sold protection on would default simultaneously, and that it suddenly was going to be on the hook for billions of dollars it didn’t have when large amounts of homeowners defaulted on their mortgages.

In the case of Goldman and AIG, it’s as if Person A sold his credit card debt to Person C, but made itself the beneficiary of the credit card insurance it bought from Person B.

Financial institutions such as AIG that sold CDS contracts between 2000 and 2006 got into serious trouble two years ago because, in large part, those financial institutions did not have the liquidity to pay for the bonds that it sold protection on.

Joshua Rosner, a bond analyst at Graham, Fisher & Co., told reporters, “If these allegations (against Goldman) are correct, it appears to have been a direct transfer of wealth from the Treasury to Goldman's shareholders. The AIG counterparty bailout, which was spun as necessary to protect the public, seems to have protected the institution at the expense of the public.

Officials at both Goldman and AIG declined to comment.

Goldman has had recent brushes with the law. Last year, it agreed to pay $550 million in fines over a lawsuit filed against it by the Securities and Exchange Commission. In the suit, the SEC accused Goldman of selling a bundle of bonds backed by the subprime mortgage markets to one investor on behalf of another investor, who netted $1 billion by buying insurance on those bonds when they failed.