Propping up Fannie Mae and Freddie Mac will cost taxpayers $154 billion under the most likely scenario for home prices, the mortgage giants' regulator said Thursday. But the bill could end up much greater—nearly double the $135 billion already spent—if grimmer projections prove true and the economy slides back into recession.

The projections, based on the results of a home-price "stress test" by the Federal Housing Finance Agency, offered the first public estimates of the final cost of the government's rescue of the mortgage-finance firms, which is on track to become the most expensive legacy of the 2008 financial crisis.

"Today's projections show that, in the most likely economic scenario, nearly 90% of the losses at Fannie Mae and Freddie Mac are already behind us," said Jeffrey Goldstein, under-secretary for domestic finance at the Treasury Department.

The results could shape the debate over the long-term role that the government should play in the mortgage market. Some Republicans argue the government should focus on shrinking the firms and ultimately privatizing them.

The Obama administration, which has promised to outline its proposed overhaul of the broader housing-finance system by next January, has said a government role may still be needed to preserve the long-term, fixed-rate mortgages that have become the keystone of the American mortgage market.

The U.S. government took over the firms two years ago and has agreed to inject unlimited sums to keep them afloat. Fannie and Freddie must pay 10% dividends on those infusions.

The cost to taxpayers excludes those payments, which could add between $67 billion and $91 billion in losses for the firms and will likely keep them from ever returning to profitability. While some housing-industry lobbyists have pushed for the government to ease the dividends, an Obama administration official said any changes should be made only as part of a broader overhaul.

For more on this story, click here.