> they don’t prevent crime, they just enumerate it.
This isn't always correct and is rather myopic.
Quite often laws will issue punishments for some behaviors, but also issue things like funding for programs that work on the roots of why particular crimes occur.
Now, laws that punish post ad hoc are always easier to measure and see, because it's much harder to prove that you prevented something that only had a probability of happening in the first place.