If it's main purpose was deterrence, then why put in prison people who killed soneon by accident? Not murder but manslaughter. And person is really sorry for that act and would do anything to be sure it to not happen again.
In contrast, serving sentence in prison may change their personality.
So as I see it: it's revenge + lesson to people outside, to not commit crime.
Deterrence doesn't only mean to discourage the perpetrator from recommitting the act, it means to deter the public at large getting doing so, for fear of punishment. So in the event of an accident caused by willful negligence, tyou would want to discourage others from being similarly negligent. For example, someone texting while driving who runs an intersection and causes a fatality. One reason to punish them is to impress upon others in your community to show care and awareness while driving.
I'm not endorsing this practice, just stating how I think deterrence is alleged to work.
In contrast, serving sentence in prison may change their personality.
So as I see it: it's revenge + lesson to people outside, to not commit crime.