WASHINGTON — Among the banks that rule Wall Street, Citigroup got a bailout that was bigger than the rest. Now the company is about to pay a king’s ransom for its federal rescue.

The Obama administration is making final preparations to sell its stake in the New York bank, according to industry and federal sources. At today’s prices, the sale would net more than $8 billion, by far the largest profit returned from any firm that accepted bailout funds, and the transaction would be the second-largest stock sale in history.

On paper, the government’s 27 percent stake has grown in value to $33 billion. The size of the deal in the works has Wall Street buzzing. Only the stock offering by Japan’s Nippon Telegraph and Telephone, which raised $36.8 billion in 1987, was larger, according to Thomson Reuters.

Leading financial firms, including J.P. Morgan Chase, Morgan Stanley and Goldman Sachs, are vying to be chosen as the deal’s underwriters to gain the prestige of managing a historic stock sale as well as the fees from investors who buy the shares. To improve their chances, some banks, such as Goldman Sachs, are offering their services to the Treasury Department at almost no cost, industry officials familiar with the matter said.

The windfall expected from the stock sale would amount to a validation of the rescue plan adopted by government officials during the height of the financial panic, when the banking system neared the brink of collapse. A year ago, Citigroup’s stock hovered around a dollar a share and the bank’s future seemed in doubt. On Friday, the stock closed at $4.31, nearly 400 percent higher than that low.

If the sale proceeds as planned, Citigroup would be able to cut nearly all of its ties to the $700 billion bailout program known as Troubled Assets Relief Program. Meanwhile, the administration could highlight the profit generated from the rescue.

“It’s unprecedented to do (a stock sale) of this size right after the financial industry has been so battered,” said an industry official, who spoke on the condition of anonymity because he was not authorized to comment publicly. “It’s just a very bullish sign.”

The Treasury, as well as the Wall Street firms, declined to comment on the stock sale.

Citigroup’s performance has lagged behind its rivals in lower Manhattan. In January, the company announced a loss of $1.6 billion for last year. comparison, J.P. Morgan Chase earned $11.7 billion. But Citigroup’s executives said at the time that they saw its business stabilizing, allowing the company to set aside less money in the last three months of 2009 to cover losses than it did for the same period of 2008.

Citigroup was among nine major banks that were the first to take bailout funds in October 2008, and all have returned their federal loans.