It's not really "lending to gamblers", they are not giving money with the explicit purpose of it being used for gambling and such (nobody would be crazy enough to do that).
In Brazil, credit cards are used as a way of financing not only current expenses (let's say a trip, your daily shopping, etc.) but also in place of small loans (those are not very common), and used to buy appliances, pay a unexpected bill that you cannot afford with your standard income, etc. This model leads to a huge problem with unpaid credit card invoices, that is predatorily explored by financial institutions that apply sky-high interest rates for overdue bills. The issue is rather complex: you have a mix of economic disadvantage, social inequality, lack of financial education and predatory practices. The current government is trying to curb the latter, but given the general lack of economic resources for a big part of the population, and the impossibility for them to access better lines of credit, the problem is not going away any time soon.
Gambling is simply another way to spend that credit card money, and it's obviously particularly awful, but a lot of people who bought a refrigerator, a kitchen stove or an old car they need to work, are in the same situation, with interests that they cannot afford to pay back.