WASHINGTON — Federal officials swooped in to rescue mortgage finance giants Fannie Mae and Freddie Mac in 2008 with the largest of all the financial crisis bailouts — a combined $187.5 billion — because they were considered too big to fail.

Now, despite bipartisan support to shut them down, Fannie and Freddie may prove to be too profitable to close.

Fannie and Freddie play a vital role in the mortgage market by purchasing or guaranteeing more than 6 in 10 new loans. And the housing market's recovery has reversed the finances of the once-private companies, now wards of the U.S. government.

Fannie and Freddie are not only making money but also sending huge dividend checks to the Treasury — a combined $39 billion this week for their latest quarterly payment — and some are wondering why they should be put out of business.

"We're a country that's running huge deficits, and here are two government entities that are going to produce somewhere in the neighborhood of $40 billion to $50 billion a year for the government," said Guy Cecala, publisher of Inside Mortgage Finance Publications, which produces industry newsletters. "Can we really afford to kill off cash cows?"

Big payments from Fannie and Freddie this summer helped delay the deadline for raising the nation's debt limit. And with the latest dividend checks received Tuesday, Fannie and Freddie have paid the government a total of $185.3 billion since 2008, nearly offsetting the entire cost of the bailout.

Their turnaround has made the companies attractive to private investors.

In November, hedge fund Fairholme Capital Management, which owns a combined $3.5 billion in preferred stock in the two companies, proposed to buy the mortgage-insurance businesses of Fannie and Freddie in a recapitalization plan.

The Obama administration rejected the idea. President Obama has been clear he wants to shut down the two companies and replace their role in the market with a new, scaled-down government approach to mortgage guarantees.

Key House and Senate committees are working on legislation that would put Fannie and Freddie out of business, though the bills take much different approaches to replacing them.

But the large dividend payments complicate the efforts to pass the bills. Because Fannie and Freddie now are a significant source of revenue for the government, legislation to close them needs to include spending cuts or other measures to offset the income lost in their shutdowns.

"The government doesn't feel any rush to shut down" Fannie and Freddie, said Stuart Gabriel, director of UCLA's Ziman Center for Real Estate. "They are profitable today, and they do provide the vital function of providing liquidity to the marketplace."

Fannie and Freddie own or back more than $5 trillion worth of mortgages. The legislation to shut them down calls for a slow process to avoid damaging the housing recovery. Cecala estimated that about 62% of new mortgages in the third quarter were financed or funded by the companies.

But lawmakers said they remain committed to shutting them down, arguing that taxpayers face losses for the mortgages backed by Fannie and Freddie if there is another housing market collapse.

Even returning Fannie and Freddie to their previous role as so-called government-sponsored enterprises — private companies that are federally chartered to fulfill a public mission — would not solve that problem because there still would be the expectation officials would rescue them again, said Sen. Mark Warner (D-Va.), a leading player in the effort to overhaul the housing finance system.

"No matter how you dress it up, it pretty much ends up with private-sector investors doing well when times are good and taxpayers on the hook when times are bad, and I just don't see how that is sustainable," Warner said.

The Federal National Mortgage Assn., the original name for Fannie Mae, was created in 1938 as a government agency to help the housing market during the Great Depression. It purchased government-backed mortgages from banks so they would have more money to lend.

Fannie later evolved into a private, for-profit company allowed to purchase private mortgages as well. In 1970, Congress created the Federal Home Mortgage Corp., which later adopted its nickname Freddie Mac as its formal name, to compete with Fannie.

Now, the two companies buy mortgages and pool them into securities that are sold to investors. The banks get more money to lend, and Fannie and Freddie get more money to buy mortgages, helping grease the housing finance system.

The companies also guarantee loans against defaults and hold on to some of the mortgage-backed securities themselves.