Honestum non semper quod licet. “What is lawful is not always honorable.” This is very true, and especially so when the law is made by scoundrels for the benefit other scoundrels. This saying is a bit of what is called “law Latin,” Latin phrases that are sometimes used by attorneys in legal proceedings. (There are also French phrases called “law French.”)
I don't know that this is about scoundrels drawing up laws to benefit other scoundrels, but rather that certain things are always morally wrong, no matter what the laws of a given country (or even all the laws of all countries) say about it. It's a seriously debatable (in the real sense) philosophical idea.
My remark about scoundrels was an observation of my own. The translation I gave is, I believe, accurate. When lawyers quote it in court, however, they are generally questioning the moral intent of the person to whom they apply it.
Actually I would say this is fact of life, that the realm of laws and constructs that many people consider moral or honorable do not coincide. Those grey areas are the source of much profit.