I think the explanation is that growing up in an environment where even small infringements are consistently punished makes people think about the consequences more.
So when a lot of people grow up in an environment where small rulebreakings are consistently caught and punished (the former is more important, can't punish what isn't detected), they learn from an early age that rulebreaking carries consequences nearly every time, and you end up with far fewer people willing to break the rules.
It's one thing to discuss something like a school campus with a small cohort of relatively similar wants and needs and a relatively small set of rules, it becomes much more complicated when dealing with the entire society's interaction with laws.
The mere possibility of severe butt-pain keeps all the would-be criminals in line.
I can definitely get away with it, but just in case I cannot - it's not a mere jail holiday that I face as consequence - I wont be able to even sit down without screaming like a baby -> The foolish criminal becomes wise and the hardened criminal becomes enlightened with this fundamental realization.
The Possibility of Pulverizing Pain via the Holy Cane is the Divine Motivation to Obey the Law.
1. aside from the obviously effective but difficult to implement deterrent of meeting everyone's physical needs