Ideally, no punishment would ever need to be laid upon anyone because they would all obey the law after weighing the effects of the punishment against what they would gain from breaking the law.
This makes sense on the surface, but when the choice is "risk getting caught" vs "put food on my table for this week by working and leaving my kid at home", it's a lot muddier.