This isn't quite right. SCOTUS managed to make up their own interpretation that FHFA's best interests are those of the general public.
beneficial to the Agency and, by extension, the public it serves.
When they say that FHFA has the right to give the money to Treasury they're actually conflating Treasury with the general public.
Neither of these interpretations are correct. The statute doesn't say FHFA's interests are those of the general public. FHFA's interests may be the greediest, self-enriching shit ever and acting on them would still be totally OK according to SCOTUS. But somehow their ridiculous interpretation is that FHFA can act in the best interest of Treasury, the general public, or itself, and all of those interests supersede the GSE's.
But the biggest problem of them all is that because of this interpretation, FHFA is never legally required to act in the best interest of the companies. IMO this leaves no framework from which to govern, and basically reduces HERA to suggestions instead of rules.