Secure inpatient treatment does not require overly punitive responses, though it does as you note require a sufficient period of time away from the substances being abused (prison is typically not such a place). 

And it requires an actual treatment plan that gets to the root causes of addiction, along with aftercare coping strategies to stay clean after lrelease.