The U.S. Treasury has agreed to cut its ownership stake in American International Group Inc. to 63 percent by selling 163.9 million shares for approximately $5 billion, with the insurer agreeing to buy back about $2 billion worth.

The U.S. government, which currently owns 70 percent of AIG common stock, acquired its shares as part of a $182 billion bailout of the insurer in 2008, the largest-ever rescue of a single corporation, and is gradually exiting its investment.

The Treasury said that it plans to sell its shares at a public offering price of $30.50 per share, a 7 percent discount to Friday’s closing price of $32.83 but a little higher than its previous sale price of $29 in March. The stock has run up some 42 percent for the year to date.

AIG said it has agreed to purchase 65.5 million shares. The insurer this month reported quarterly profit more than doubled from a year earlier, exceeding expectations with the help of investment gains.

The government has pared its stake in the company twice previously. The March sale followed one in May 2011.

“We remain hopeful that taxpayers will ultimately recover every single dollar invested in the company, which is something few would have expected during the depths of the financial crisis,” Tim Massad, the U.S. Treasury assistant secretary for financial stability, said in a statement late on Sunday.

The Treasury has also granted underwriters a 30-day over-allotment option covering another 24 million shares.

Assuming no exercise of the over-allotment, the Treasury will reduce its remaining investment in AIG to $30.7 billion, totaling just over 1 billion shares of common stock.

In addition to stock ownership by the Treasury, the U.S. government AIG portfolio includes a Federal Reserve Bank of New York loan to Maiden Lane III totaling about $8 billion.