A Goldman Sachs executive told an inquiry panel Thursday that the firm had no regrets about collecting billions of dollars in taxpayer money for correctly predicting the demise of the U.S. housing market.

David Viniar, Goldman's chief financial officer, said Uncle Sam had an obligation to honor American International Group's full debts. The firm was entitled to be paid $12.9 billion out of the $182 billion bailout that went to crippled insurance giant AIG — the largest federal rescue.

"The government stepped into AIG's shoes" and therefore had to honor its contract with Goldman, Viniar told the congressionally appointed panel investigating the financial meltdown.

Members of the Financial Crisis Inquiry Commission couldn't understand how Goldman could take the full amount owed by AIG, knowing that the U.S. taxpayers were picking up the tab at the onset of the worst recession since the 1930s.

"You were 100 percent recompensed on that deal and the only people who were out money were the American public," said panel member Brooksley Born, who headed the Commodity Futures Trading Commission in the late 1990s.

The government "paid 100 cents on the dollar for something that was going for 48 cents at the time," said Bill Thomas, the panel's vice chairman and a former California Republican who was chairman of the House Ways and Means Committee.

The crisis inquiry panel probed Goldman's actions during a second day of hearings examining the firm's relationship with AIG, and how their derivatives trading helped push the country into financial distress.

AIG sold billions of dollars of credit default swaps, guarantees on mortgage securities that ended up forcing the company to pay out billions after the subprime mortgage bubble burst in 2007.

Goldman Sachs Group Inc. profited from its bets against the housing market before the crisis. Its derivatives dealings have drawn harsh scrutiny. The firm continued to reap huge profits after accepting federal bailout money and other government subsidies.

A previously disclosed 2007 e-mail has Viniar indicating that the firm made more than $50 million in one day on bets that the housing market would founder.

Viniar and other executives also discussed a dispute between Goldman and AIG in 2007-2008 over the amount of collateral that AIG needed to put up because of the plummeting value of the mortgage securities it insured.

And the Goldman executives defended the lower values they placed on transactions with AIG, resisting suggestions that Goldman's demands for increased collateral from AIG helped push the company to the brink of collapse.

"Goldman's prices were formed by diligently observing and reviewing the best available information from the market through its role as a market maker," said David Lehman, a Goldman managing director.

Goldman demanded in July 2007 that AIG put up about $1.8 billion in collateral. "At various times during the dispute, Goldman was willing to, and did, receive less than it was entitled to from AIG as a partial payment of its collateral demand," Lehman said. Goldman did not, however, reduce its demands to the level that AIG offered, but kept its demands at levels determined by market prices, he said.

Also appearing at Thursday's hearing: former AIG executives Stephen Bensinger, Andrew Forster and Elias Habayeb; Gary Gensler, chairman of the Commodity Futures Trading Commission and Eric Dinallo, the former top insurance regulator in New York state,

A former official of the Office of Thrift Supervision defended the federal agency's oversight of AIG in 2006-2008.

"We didn't have the resources," said Clarence Lee, who was managing director for complex and international organizations at the agency. Still, he said, the office made "increasing supervisory criticism of AIG's risk management" and other practices during the period and took enforcement actions against the company.

AIG was regulated by the OTS, but its exploding business of credit default swaps was run out of London and elsewhere, and fell through the regulatory cracks. The result was the massive taxpayer bailout giving the government an 80 percent stake in the company.

A former top executive of AIG said Wednesday that if he had been allowed to keep his job, he could have saved taxpayers a bundle.

"I think I would have negotiated a much better deal for the taxpayer than what the taxpayer got," Joseph Cassano, the former chief executive of AIG's Financial Products Division, told the inquiry panel.