It’s not deterrence, that’s not the point. Deterrence does not work.
It’s about sending people to prison so they can do cheap labor. It’s also about racism because it’s disproportionately targeted towards minorities. It absolutely makes sense in that light.