Sergeants do not punish their soldiers for their misdeeds. Punishment is a specific term for the penalties awarded either through Non Judicial Punishment (by ones commander) or via a court martial.
Instead, Sergeants motivate, correct, instill a sense of discipline, alacrity, and attention to detail. They make on the spot corrections, and they provide corrective training, and extra military training to bring their soldiers up to the expected standards of behavior and performance.
Now, how they do that… can be sometimes somewhat creative.
And yes, I’ve both had my troops do this, and done it more than once myself.