A good book on consumer credit is: Naeem Siddiqi. Intelligent Credit Scoring: Building and Implementing Better Credit Risk Scorecards.
In the U.S., there are many federal and state laws (Equal Credit Opportinity Act, Fair Credit Reporting Act, and many others) and regulations that implement them, which prohibit discrimination in various consumer credit situations based on race, color, religion, national origin, sex, applicant's receipt of income under an public assistance program, and many other criteria. Many other countries have similar (but not quite the same) rules in place.
Not using these prohibited criteria still leaves the lenders with enough permissible criteria (for example, days past due on the applicant's rent, or the comparison of the income to revolving credit card balance) to create models that perform very well in practice. I'm not aware of any public studies that would show that taking the prohibited criteria into consideration would make the models perform any better. I have heard of some internal studies that indicate the opposite - that taking sex etc into consideration would not materially improve the models' performance. Lenders are on a mission to make money, rather than to "be evil" like a cartoon characters. It seems very unlikely that breaking these rules would help them earn any more money.
The 3 legal theories that can get a lender into trouble are:
Overt discrimination is intentional discrimination based on a legally prohobited factor.
Disparate treatment is when similarly situated consumers receive different treatment that can only be explained by a prohibited factor.
Disparate impact is when decision rules or model variables are facially neutral, but still have a disproportionare adverse impact on the basis of aprohibited factor. (This may be justified by business necessity or unavailability of any equally effective but less discriminatory alternative.)
(An often-cited example of disparate impact is - lending only to people who own Apple products, who happen to be mostly white. Here "owning an Apple product" is a proxy for being white.)
Lenders that try to work legitimately and follow all the rules that apply to them (not only fair lending, but all kinds of other rules - Bank Secrecy Act, anti-money laundering rules...) usually invest some effort into analysis of their lending practices that demonstrates that none of these 3 legal theories apply to them. They might get into serious trouble with regulators and courts if they did not do this.
For example, a common technique is: after the lending decision has been made by a model, try to guess some applicants' sex, ethnicity, etc, and show that they haven't been discriminated against.
There's not much additional money to be made by not following fair lending rules. If a bank must choose some rule to bend in order to make more money, they'd rather break some silly anti-money-laundering rules, for example.
Lenders that operate outside the framework of legitimate banking (e.g. loan sharks and other organized crime) are an important source of credit to America's "subprime" population. Obviously, they are free to discriminate and otherwise break the laws (or delinquent borrower's legs). Some of these lenders give preferential treament to ethnic or religious groups with which they're affiliated (e.g. - an ethnic Korean gangster night prefer to lend money to fellow Korean immigrants, since he knows his clientelle, and would be reluctant to do business with outsiders.) They also don't use the kind of sophisticated scoring models that legitimate lenders use.
To summarize the answer to your questions, yes, legitimate lenders try very hard to follow all fair lending rules, and also to be able to demonstrate that they do. Their consumer credit models work very well, and would not improve much if they were able to consider some currently prohibited criteria.