Michael Albertson:  It might be nice if the system worked that way but as a former lawyer I can safely tell you that is not how it works.  At sentencing the court has two options.  First they can withhold sentence and put the person on probation with a condition of probation that he gets treatment for any drug issues.  Secondly, the Judge can sentence the person to prison (assuming the underlying crime is a felony) and order drug treatment.  However that 'order' is more by way of a suggestion than a real order.  The big problem is the need far exceeds the available treatment program space.  As a result, many inmates are released before they can be enrolled in any program.  If you think it would be a good idea for courts to ignore punishing for the underlying crime simply because a perp has a drug problem, well, good luck with that.  I would never like that idea, since across the US most prisons report that only 20% of those completing a drug interdiction program are successful after.