Proverbs 21:18
The wicked shall be a ransom for the righteous, and the transgressor for the upright.
In a broad sense, this verse means that the wicked are punished, so that the righteous can go free. When those who violate the commandments of God are punished, those who obey them have the freedom to continue to do so.