Doing so improves the addicts life in the medium-long term, and provides an immediate consequence. Its something that many addicts actually want, that society wants, yet no one has the balls to actually do it.
In order to stop them from tempted to try it or go further, and prevent more people from joining that group? Or the people who deal drugs? Which decriminalization basically removed any check function on?
The "Seattle is Dying" documentary describes a treatment program called the "MAT Program" (medically assisted treatment) that is used in Rhode Island prisons. They interview several people -- both leaders of the program and former addicts -- who speak positively about it: https://youtu.be/bpAi70WWBlw?si=ZkMQb3tb5P_Ztbvs&t=2645