Goldman Sachs Group Inc sold $5 billion of stock to help fulfill what it called its duty to repay a federal bailout, but the government fears a quick return of the funds would put other banks in a bad light.

The sale of 40.65 million shares at $123 each, or 5.5 percent below the Monday closing price of Goldman shares, gives the bank roughly half the funds it needs to return the $10 billion it took from the Troubled Asset Relief Program.

The Tuesday sale came a day after Goldman posted better-then-expected quarterly earnings, bolstered by substantial risk-taking.

In morning trading, the bank's shares were down $6.51, or 5 percent, at $123.64 on the New York Stock Exchange.

Repaying the taxpayer funds would free Goldman from many government restrictions, including caps on executive pay. Chief Executive Lloyd Blankfein's compensation fell to $1.1 million last year from $70.3 million in 2007, Goldman's proxy filing shows.

Goldman converted to a commercial bank in September as a credit market freeze and Lehman Brothers Holdings Inc's bankruptcy upended the Wall Street investment banking model.

We never believed the investment of taxpayer funds was intended to be permanent, Goldman CFO David Viniar said on a conference call on Tuesday. We view it as our duty to return the funds, as long as we can do it without negatively impacting our financial profile, or ability to act as a central liquidity provider to the global capital markets.

Goldman's first-quarter results may raise expectations for rivals scheduled to report this month, including JPMorgan Chase & Co on Thursday, Citigroup Inc on Friday, and Bank of America Corp and Morgan Stanley next week.

While repaying TARP might show strength, the Treasury Department worries it will harm the recovery effort by making rival banks appear weak, a person familiar with the Obama administration's thinking said. The person was not authorized to speak publicly.

HIGHER TRADING RISK

Goldman on Monday posted a $1.66 billion first-quarter profit after preferred stock dividends, or $3.39 per share, more than double what analysts had forecast. It also said it lost $1.03 billion, or $2.15 per share, in December.

The bank converted to reporting results on a calendar-year basis. Viniar said profit resulting from payments from ailing insurer American International Group Inc rounded to zero in the first quarter.

David Trone, a Fox-Pitt Kelton analyst, said Goldman benefited from a windfall in fixed income, currencies and commodities results that is unlikely to repeat. He rates Goldman in line.

Goldman said its value at risk, or the maximum it would expect to lose daily on 95 percent of trading days, rose to a record $240 million in the first quarter from $197 million in the fourth quarter. It ended the first quarter with $925 billion of assets, up 5 percent from the end of November.

The trading activity suggests that Goldman has not backed off in any way from taking risk in the markets, wrote Richard Bove, an analyst at Rochdale Securities.

DANGEROUS ENVIRONMENT

Even so, Viniar said the environment remains dangerous in light of extremely difficult macroeconomic conditions and tight credit, which put a premium on liquidity.

But Goldman is doing less to diversify away from businesses sensitive to capital markets and corporate business activity.

Morgan Stanley, for example, is taking a majority stake in a venture combining its brokerage with Citigroup's, and has said it plans to bulk up in retail banking.

We're not really a consumer lender, Viniar said.

Repaying TARP could be risky if conditions worsen more than Goldman expects, and Viniar acknowledged that the company may be more upbeat about the economy than others.

Our economists are, I would say, more optimistic or less pessimistic than they've been about the outlook for the economies going into the second half of the year, so that gives us some cause for optimism, he said.

(Reporting by Dan Wilchins, Jonathan Stempel and Christian Plumb in New York, and Karey Wutkowski in Washington; editing by John Wallace)