This has a broader purpoae in democracy. Laws change as people realize they are stupid and disobey them then opinion changes and the law catches up. The chance of being caughy and/or the punishment cant be too high to short circuit this for all but the most obviously bad crimes (ie murder, large scale theft, rape)