Baruch Spinoza said this quote

All laws which can be violated without doing any one any injury are laughed at. Nay, so far are they from doing anything to control the desires and passions of men that, on the contrary, they direct and incite men's thoughts the more toward those very objects, for we always strive toward what is forbidden and desire the things we are not allowed to have. And men of leisure are never deficient in the ingenuity needed to enable them to outwit laws framed to regulate things which cannot be entirely forbidden... He who tries to determine everything by law will foment crime rather than lessen it.