I stumbled upon a Explain Like I am Five Story which dealt with the rationale behind punishments. The topic of punishments is a complex one and needs balanced thinking. The author elucidated many reasons for which punishments are administered in society. We see the trends of those in both online and offline societies.
Punishments are administered for one of the following reasons.
Is stopping somebody from doing an unacceptable behavior in the society again.
Is getting something back for the victim of somebody who misbehaves, to compensate them for that which they've been deprived by the offender. Like charging fine and using it for taxes.
Is like feeling of justice that deprived might get. Many of us think, this is the primary purpose for punishment. This is non measurable, but often paves way to other measurable impacts like incapacitation, restitution etc.
The purpose is to give the offender, time to reflect on the wrong doing, possibly empathize with the one affected.
Is about reducing the likelihood that misbehaviour will occur in the first place. The punishment is more for a warning to prevent a socially unacceptable behavior.
Many a social regulatory policies can be mapped to above concepts of negative reinforcements to prevent any undesirable outcomes.