WASHINGTON—A federal judge grilled a government lawyer Wednesday over the 2008 rescue of American International Group Inc. as closing arguments wrapped up in a case that challenges whether the historic U.S. bailout was legal.

When the lawyer for the Justice Department defended the government’s 79.9% equity stake acquired in exchange for an emergency loan of $85 billion, Judge Thomas Wheeler of the U.S. Court of Federal Claims said “it doesn’t seem far fetched” to question the deal’s rigidity. “I mean, come on.”

...