Making an example of an offender
On the axis: The meaning of punishment · the offender
Punishing to deter is using one man to frighten others: does only the penalty deserved for what he did treat him as a responsible person, rather than as a means?
Justification
Punishment is demanded by justice itself, as retribution proportionate to the crime (juridical law of retaliation), never as a mere means of social utility: punishing someone to deter others would treat him as a means. This is classical retributivism.
Metaphysics of Morals, Doctrine of Right, §49 E
Justification
Crime negates right; punishment is the negation of that negation, which annuls the crime and restores right. Deterrence treats the criminal like a dog threatened with a stick; retributivism, by contrast, honors him as a rational being, for his punishment is contained in his very deed and constitutes his own right. The measure is not literal like-for-like, but the equivalence of value between crime and punishment.
Elements of the Philosophy of Right, §90-103 (§99 negation of the negation, §100 the criminal honored, §99 Add. the stick and the dog)