If they knowingly violate the law, the regulators will come down on them. And the law requires bad loans. CRA exams are as important as regular exams.
For your reading enjoyment: https://www.frbatlanta.org/banking/publications/community-reinvestment-act/your-banks-overall-cra-rating.aspx
Then maybe the government should quit requiring banks to make loans they know will never be repaid.