Jim Cramer, former hedge fund manager and host of CNBC's Mad Money, said investors should purchase newly-privatized General Motors (NYSE:GM) shares because it's a good idea to buy from the federal government whenever it has a privatization up its sleeve.

In an MSN Money commentary, he said GM shares shares should rally to $40 and investors should keep on buying until it gets there.

The previously bankrupt and bailed-out GM traded on the New York Stock Exchange for the first time on Thursday since the bankruptcy. It closed at $34.19, or up 3.61 percent from its initial public offering (IPO) price of $33.


The U.S. government previously owned a 61 percent stake in GM. After this week's IPO, the stake has been reduced to about 33 percent. For the government to exit this investment profitably, it would need to sell that remaining stake at an average of $49 per share.


That just might happen, and the government could even make some money, if GM stocks perform like the following historical examples Cramer cited. 


In 1979, the government bailed out rival automaker Chrysler with a loan guarantee and received stock warrants to buy some shares at $13 at a time when Chrysler shares were trading at $7.50. By 1982, the automaker paid back the loan, bought back the government's warrants, and its stock had soared 280 percent.


In 1987, the government put Conrail, which comprised of bankrupt railroads it had rescued, up for IPO.  The stock then went on to appreciate a total of 8.5 percent in a one-year span, 182 percent in a five-year span, and 707 percent in a ten-year span.


More recently, the government acquired parts of Citigroup (NYSE:C) at $3.25 per share last summer.  Now, Citi is trading at $4.30, which is 32 percent higher.


It has paid to take the other side of the government's trades, said Cramer.