I don't quite agree with the notion that not committing crimes is a way to stay out of jail. Far too many people get convicted of crimes they didn't commit for that to be true, imo, and there is little to no accountability on law enforcement and the judicial system even when they maliciously and intentionally convict the innocent.

That's not even touching the fact that nowadays there are so many laws that not only does no one have any idea how many there are, but everyone is probably a felon many times over without even knowing it.

If a prosecutor wants to put you in prison, off to prison you will likely go...

If angels were to govern men, neither external nor internal controls on government would be necessary. In framing a government which is to be administered by men over men, the great difficulty lies in this: you must first enable the government to control the governed; and in the next place oblige it to control itself. - Federalist 51