Yes. Fannie and Freddie sell those loans to investors, they don't hold them. They just insure them against defaults. But prepayments are still investors' problems as far as I'm aware.
The Gses bundle up the mortgages and sell mortgage backed securities to investors. The prepayment risk flows through to those investors. As an extreme example, some securities they separately sell the principle payments and the interest payments. So if you bought the interest payments on a bunch of mortgages you stop getting paid as people prepay.
The folks who bought the principle payments are very happy to get paid early.