“When banks didnt want to lend to risky borrowers, they were painted as racist and forced by the government to make the loans.”
Absolutely correct. The banks were dragged into doing substandard loans by the Feds. When banks said they didn’t want those loans on their books the Feds said Fannie and Freddie would buy them. When the banks said there was no profit in them the Feds not only permitted but encouraged the use of mortgage backed securities which made swimming downstream with the Feds hugely profitable for a while.
In the end, the bailout just meant that we taxpayers subsidized those risky borrowers - and the government took their side to keep them in the homes we bought for them...