Getting even deeper into the weeds, the NY Fed Bank website details a series of transactions. Initially, the NY Fed holdings of AIG assets pledged as collateral were held in a trust for the benefit of the US Treasury, with later transactions having the NY Fed gradually turn them over to the Treasury or otherwise releasing them back to AIG and its successors. In any event, the economic reality is that the Fed provided the cash and structured the transactions for its convenience.
The Fed lent, the Treasury bought stock.