In order for the United States to recoup all of its $50 billion investment in General Motors, it must sell its ownership stake at $134 a share, according to the special inspector general of the government's bailout programs.

The estimate comes as the automaker readies itself for a public stock offering, setting the stage for the government to withdraw from its majority stake in the company.

The price needed for a full recovery of the U.S. investment is far higher than shares of the automaker have ever reached, and some analysts and government officials have expressed doubts that the United States will be able to recover the money.

But with GM turning a profit in recent quarters, some Wall Street analysts have lauded the company's prospects, noting that it has shed much of its debt, discontinued brands, closed plants, and slashed its workforce. As a result, it is much better prepared to weather a slow economy - and could be very profitable when auto sales reach pre-recession levels, the analysts have said.

Last week, in fact, Morningstar analyst David Whiston issued a preliminary estimate setting the shares' fair value at $134.

"GM's cost structure is drastically improved," Whiston wrote in a Sept. 13 note to investors. "We think GM's earning potential is excellent because it finally has a healthy North American unit and can focus its marketing efforts on just four brands instead of eight. . . . We think it is critical for investors to know that GM now makes excellent car models as well as light trucks."

After the $50 billion investment in GM, the United States held a 61 percent stake in the company, as well as $2.1 billion in preferred stock and a $6.7 billion loan. The loan has been repaid, and whether the government can recoup its investment depends largely on the share price.

The government's estimate that the shares would need to sell for $134 came from Neil M. Barofsky, special inspector general for the Troubled Assets Relief Program, in a recent letter to Sen. Charles E. Grassley (R-Iowa).

News of the estimate came as it was announced that Herbert M. Allison Jr., the Treasury official who has administered TARP, would be resigning. Allison had previously served as president of Merrill Lynch and TIAA-CREF.

"The fact that TARP is now regarded by many experts as one of the most effective emergency programs in financial history is a direct result of Herb's leadership and all of your hard work," Treasury Secretary Timothy F. Geithner said. "This is not just our program to eulogize. The Bush administration started the job. We finished it."