That is precisely what laws do by definition and have done in practice, from the Code of Hammurabi to this day.
Huh amazing. That’s why no one e breaks them then …