In some states in the USA that have medical marijuana laws there are private clubs that can under state law distribute marijuana to people with doctors note. Doctors can't prescribe marijuana because prescriptions are controlled by the Federal Gov.

So they write a letter under state law that Say's you have proved medical necessity.

It's still Illegal under federal law and some clubs do get raided and their medical marijuana is taken away but still only a small hand full ever are arrested or even jailed over night.