Nearly six years after the government rescued Fannie Mae and Freddie Mac, top members in the Senate and the White House agreed on a framework to wind down the mortgage giants and overhaul the nation's $10 trillion mortgage market.

The bipartisan proposal, coming just as the firms have begun to generate huge profits for the Treasury, complicates the picture for a host of deep-pocketed investors who had bet that Fannie and Freddie...