The government policies didn't "encourage" loaning to such people. They specifically _forbade_ it. The problem was that the deregulation regime didn't provide any "stick" to back up that prohibition. So on one side it offered a financial carrot of massive proportions, the other side just said "it's your duty to not do X and Y and to make sure that you are being good."
The people who bought, paid for, and essentially wrote the legislation, that is the banks, didn't put any "and for every time you fail your duty by doing X and/or Y you will be charged $Z language.
This is called Regulatory Capture, or it's an eventual but certain outcome of regulatory capture. The law was balanced in "intent" and wording, listing things that were good and bad to do and ordering that none of the bad things be done. But it had no teeth to bite bad behavior.
Much as the entire libertarian and "small government republican" agenda, the "we all know what's right so the market will fix it" stuff falls apart in the trenches because without penalty all business and behavior becomes a choice between "do I eat the ice cream now or do I make an ice cream sandwich and then eat that"? If there is no "bad boys get their ice cream taken away" there is no reason expressed by market forces to not be a bad boy.
Example: the theory is "the market isn't going to buy his stuff if he is a bad man polluter of his river" is, in practice, "the people down stream _might_ not buy his stuff because he's polluting their water, but there are lots of people upstream who don't even want to know about the pollution and will buy his stuff."
So the "mortgage lenders" knew that they could make toxic loans and sell them upstream to banks knowing that the government who lived down stream would have to deal with the shit in the financial river eventually. But why would the mortgage broker care, the "free market" already paid him for his product.
"Free Market Capitalism" is the worship of the carpetbagger and the insistance that nobody can escape forever, but if you give everyone a head start thats longer than the statue of limitations, and you don't even make it against the law, nobody is even chasing the crooks.