James K's answer is correct about the reasons in favor of limiting interest rates1.
That said, since Spain's laws are specifically quoted, I would like to give some additional data.
First, there are three different rules:
for remunerative interest: what is usually understood as the interest.
for 'late' interest: interest to pay if the borrower delays in the payments.
for 'late' interest of mortgages.
For the first one, the regulatory basis is a law from 23 July of 1908 that declares void and null loans with excessive rates that are accepted because the borrower is in a situation of need(link in Spanish). It does not set a fixed limit, though, and sentences often differ; the link states that in a case a 20.5% rate was considered lawful by the Supreme Court, a 29% one abusive. In any case, I cannot find any reference to a "hard" limit2.
For 'late' interest rates in loans, recent sentences(link in Spanish) have capped those to 2 points over the remuneratory interest; if the remuneratory interest is 8% the late interest must be at max 10%. This is important because usury usually relies on people being unable to pay in time, the 'late' interest rates are overlooked by customers who believe they will be able to pay.
For 'late' mortgage interest rates, recent sentences by the Court of Justice3 of the European Union have set a cap of 2.5 times the legal interest of money. This limits is independent of the 2% limit above specified, so the minimum of both values should be applied. Also of interest is that it declares an abusive 'late' interest clause completely null; if the clause is abusive it is not to be "ammended" by the judge but completely ignored so the only appliable interest rate would be the renumerative.
Also, this last rulings have led to some courts recently setting a cap of 2.5 times the legal interest of money for the 'late' interest for personal loans, but AFAIK these rulings were done by lower courts and still there is no validation by the Supreme Court.
1You can see an example of what lawmakers want to avoid in this John Oliver program. And this other program about car loans is remarkably similar.
I would like to add that, unlike the USA, in Spain there is no possibility of filling for personal bankruptcy.
2A few years ago there was a series of sentences against chains of "small loans suppliers" who targetted high interest loans towards people who had difficult getting loans from banks; the judges considered that asking twice the interest rate of banks was usury.
3Like this one.