However, it did concede that the government overstepped its authority with "overly harsh" conditions imposed on an $85b loan to prevent AIG from collapse.
The government took an 80% stake in the company and 14% interest on the loan.
In total, AIG received nearly $185bn in aid during the financial crisis.
Mr Greenberg, through his company Starr International, had sought $50bn in damages on behalf of the company and its shareholders.
Starr was the largest shareholder in AIG at the time of the bailout, with a 12% stake.
But Judge Thomas Wheeler awarded no damages because the alternative to the loan would have been bankruptcy.
"In the end, the Achilles' heel of Starr's case is that, if not for the government's intervention, AIG would have filed for bankruptcy," he said in the ruling.
''In a bankruptcy proceeding, AIG's shareholders would most likely have lost 100% of their stock value."
The US central bank, which worked with the US government on the bailout, said it strongly believed its actions "were legal, proper and effective".
"The Federal Reserve's extension of credit to AIG prevented losses to millions of policyholders, small businesses, and American workers who would have been harmed by AIG's collapse," it said.
The Fed added that the terms of the deal "were appropriately tough to protect taxpayers from the risks the rescue loan presented".
A court has ruled that former AIG boss Hank Greenberg should get no damages in his case against the US government over the insurer's 2008 bailout.