In general, Richard Posner (in “Economic Analysis of Law,” Little, Brown and Company 1973) wrote that “Punishment is the price that society charges for a criminal offense.” (p.2) This he derived from the law of demand, a relation between price and quantity.
In hidden information problems, such as Principal-Agent, the principal has the right to hold the agent accountable. Usually the agent is subjected to certain prior law or standard, for which they take the risk of paying penalties if they violate them.