The government buys some loans (the Fed has been purchasing mortgage-backed securities since the start of the pandemic), but generally, mortgages are bought by private investors. If the loans are "agency" loans (Fannie, Freddie, FHA), investors are guaranteed the principal of the loan if the borrower defaults.
I can tell you that the agencies definitely do not rubber stamp the underwriting of the loans. If you make an underwriting mistake, you may have to buy the loan bank from the investor and it will impact your perceived loan quality and the prices you can get for your loan pipeline.
Earlier comment with context: https://news.ycombinator.com/item?id=31000286
Actually, in many cases, Fannie and Freddie (known as the GSEs) literally do buy the mortgages, through a program known as the cash window [1]. Some of these they hold in portfolio, but others they sell to the private market. But the GSEs aren't technically part of the government. They are specially chartered publicly traded companies, which are currently controlled by the government agency FHFA (confusingly completely distinct from the FHA) since going into conservatorship in 2008, as a result of the subprime crisis.
In any case, it's important to note that the GSEs are profitable businesses, not part of the welfare state. They are able to guarantee conforming loans because
- the underwriting criteria actually accurate reflect risk of default and loss
- risk is shared with the loan servicer and for higher loan-to-value mortgages, private mortgage insurers.
I yap on about this because it's actually a pretty fascinating bit of public policy and financial engineering, with the result of extending massive, long-term, fixed-rate, affordable loans to regular-ass people (with a free borrower option to terminate the interest costs through prepayment, to boot!) AND create an asset class for investors that is almost as liquid and riskless as treasury bonds. The liquidity of that secondary market is what allows rates to be so low, compared to custom-underwritten products geither lent from a bank's own portfolio or securitized into private-label mortgage-backed securities. The biggest bit of controversy I know of is that it tends to fuel home price growth, benefiting propery owners over those who buy in later.
[1] https://www.machinesp.com/post/a-close-look-at-the-gse-cash-...
But the government doesn’t hold the loans for long. If they conform they are bundled and sold off. The government will back the mortgages in the bonds indirectly if they fail (which is why they need to conform to certain standards).
Well, that was the original Plan but with quantitative easing the federal reserve bought a lot of the bonds as well.
But the banks have much more stringent regulations and verifications and aren’t just rubber-stamping loans anymore like they did before 2008. The rubber-stamping stuff has moved to crypto and stock exchanges.