How is that an example of the justice system not functioning? 80-90% of people think drugs other than marijuana should be illegal. 32% see drug abuse as a "crisis" and another 55% as a "serious problem": http://www.people-press.org/2014/04/02/americas-new-drug-pol....
People thinking drug use is dangerous and making it illegal, and then putting people in jail for trafficking in drugs (which accounts for the vast majority of sentences), is not a failure of the justice system.
EDIT: Since people seem confused by certain FUD on this subject. The vast majority of "drug offenders" filling prisons are there for trafficking not possession: http://www.drugwarfacts.org/cms/Prisons_and_Drugs (only 5.3% of federal drug prisoners are serving time for possession; 91.4% are serving time for trafficking). And 80-90% of people support keeping cocaine and heroin illegal: http://www.huffingtonpost.com/2014/04/17/drug-legalization-p....
Also account for the time lag between changing public opinion and changes in policy. As recently as 2001, 45% of people polled (and probably a much higher percentage of actual voters, who skew older and more conservative), opposed getting rid of mandatory minimum sentences for non-violent drug crimes.