Florida
Title XXXIX, chapter 687 of the 2022 Florida Statutes covers usury. The technical definitions of what it is are earlier, but the punishment is as follows (I skipped the couple of exceptions to it)
687.04 Penalty for usury; not to apply in certain situations.—Any person, or any agent, officer, or other representative of any person, willfully violating the provisions of s. 687.03 shall forfeit the entire interest so charged, or contracted to be charged or reserved, and only the actual principal sum of such usurious contract can be enforced in any court in this state, either at law or in equity; and when said usurious interest is taken or reserved, or has been paid, then and in that event the person who has taken or reserved, or has been paid, either directly or indirectly, such usurious interest shall forfeit to the party from whom such usurious interest has been reserved, taken, or exacted in any way double the amount of interest so reserved, taken, or exacted.
So basically the lender can only collect the original amount loaned, no interest, and if they already collected some of the interest, they have to return that at a 2 for 1 rate.
It's a civil law, so I don't know if that's what you meant by "breaking the law/illegal", but they can go to court to recover the interest doubled.
The contract wouldn't change anything, as you can't enforce the terms of an illegal contract.