Programmes letting people swap illegal highs for medications are popping up all over the country. Here’s how they work.