That is precisely what laws do by definition and have done in practice, from the Code of Hammurabi to this day.