In the fall of 2008, during the worst of the financial crisis, software architect Matt Hill began looking for stocks that were poised for a comeback. He settled on what seemed a sure bet: Fannie Mae (fnma) and ­Freddie Mac (fmcc), the mortgage giants that guarantee and securitize home loans for middle-class Americans.

The companies had been put into conservatorship by the federal government at the height of the turmoil. But Hill figured he would share in the gains after they were nursed back to health, as promised at the time by then–Treasury Secretary Henry Paulson. “I kind of believed all that,” recalls Hill, who lives in Sacramento. “I knew housing would come back.”

More than eight years later, Hill, now 46, is still waiting for his payday, as are thousands of others, including several influential hedge funds. Housing did come back, and so did profits for Fannie and Freddie. But the government-sponsored entities (GSEs) remain under federal control, with their shares trading for the price of a drive-thru burrito. And their crisis-era investors are entangled in a skein of costly legal battles over the GSEs’ future.

Shareholders’ happiness may now depend on newly appointed Treasury Secretary Steven Mnuchin. Mnuchin, who once headed Goldman Sachs’s mortgage ­securities trading desk, has vowed to return Fannie and Freddie to private ownership. But that’s an abrupt departure from what many politicians have advocated, which means investors today are betting on a long-shot policy change. “If you’re wrong, you’ll lose all your money, but if it works out, you can make three- to 10-fold,” says one finance pro who owns the stocks in his personal account.

Like much of the economy, Fannie and Freddie were brought low by mortgage defaults during the Great Recession. When the Treasury took over in 2008, it maintained warrants on 79.9% of their common shares. The remaining 20% continued to trade in the public market, where they soon fell under $1 a share. (They had peaked at $86 in 2000.)

The bailout, which totaled $187 billion, was based on the assumption that many loans on the GSEs’ books were still shaky. Few losses materialized, however, and by 2012 the giants were on the verge of turning profitable again. That’s when the Obama administration implemented what’s known as the “net worth sweep.” Saying that Fannie and Freddie remained at risk, the Treasury deemed that it needed to take all their profits—­including dividends from so-called preferred shares they issued during the crisis—to pay itself back.

Aggrieved investors went to court, arguing that the Treasury had taken their property. Big names like Fairholme Capital’s Bruce Berkowitz and hedge fund managers Richard Perry, John Paulson, and Bill Ackman joined the battle. Recently unsealed court documents from one of those cases suggest that the sweep wasn’t necessary—and, moreover, that Treasury officials knew that at the time. But so far litigation has not borne fruit: A federal district court ruled in the government’s favor in 2014, and in February an appeals court upheld that ruling.

Since 2012, Fannie and Freddie have sent some $255.8 billion in profits to the Treasury; for 2016 they reported net income of $12.3 billion and $7.8 billion, respectively. But since those profits don’t flow to common shareholders, the primary reason to own the GSEs is to bet that they’ll be set free. “People who are buying the common shares are acting on a wing and a prayer,” says banking analyst Dick Bove, vice president of equity research at Rafferty Capital Markets.

Charts shows Freddie Mac and Fannie Mae stock performances since 2016 Nicolas Rapp

The target of the prayers is Mnuchin, who has signaled his sympathy for GSE shareholders. “It makes no sense that these are owned by the government and have been controlled by the government for as long as they have,” Mnuchin said in November. Were the GSEs to go fully public, taxpayers would have a lot to gain. “Fannie and Freddie have a value of $200 billion. That’s 20% of what Donald Trump needs for his infrastructure spending,” says Tim Pagliara, CEO of CapWealth Advisors of Franklin, Tenn., who put his clients into preferred shares in 2008.

It’s unclear when Mnuchin might act, however. For the Trump administration, Obamacare “repeal and replace” and corporate tax reform are the top priorities. Then again, tax reform might push Mnuchin to act sooner: A lower corporate rate could force the GSEs to write down their deferred tax assets, which could hurt their balance sheets and necessitate another bailout. Mnuchin could also decide not to have any more profits sent to the Treasury, which would signal that the administration wants to let the GSEs build reserves so they can operate independently again. (The next payment is due March 31.)

The best case for investors would be for Fannie and Freddie to end up like insurer American International Group (aig), which got a $180 billion crisis-era bailout. AIG restructured its operations and paid back the Treasury, which sold off its shares in 2012. AIG is struggling today, but in the three years after the government divested, its stock more than doubled. To assuage fears of future bailouts, some investors argue that GSEs should essentially become utilities—public companies that would be heavily regulated so they would avoid risky behaviors that tripped them up before.

For now, tempted investors may be best off buying preferred shares. Owners of those shares have a stronger case in the ongoing court battles. Even if Fannie and Freddie are driven out of business, preferred shareholders would have priority over common-stock investors in recovering assets in liquidation or bankruptcy.

Whatever the outcome, today’s Fannie and Freddie investors will at least know they didn’t buy high. “If I had known [federal officials] were not going to honor the commitment to preserve these entities, I would not have bought the shares” in 2008, says Pagliara. “Nobody would have.”

A version of this article appears in the April 1, 2017 issue of Fortune with the headline “Hidden Treasures or Money Pits?”