Under state law, the California Compassionate Use Act of 1996 (Prop. 215) exempts patients and their primary caregivers from criminal prosecution for personal possession and cultivation of marijuana, but NOT for distribution or sale to others.
State law was expanded in 2004 by a new law, SB 420 (Health & Safety Code 11362.7-8), which (1) authorizes caregivers who provide marijuana to patients to be compensated for the costs of their services, though not on a for-profit basis; and (2) allows patients to form cultivation "collectives" or "cooperatives." On careful examination, however, neither of these provisions provides a green light for sales of cannabis. Those dispensaries that are selling marijuana over the counter accordingly do so at the tolerance of local authorities. Note that there have been instances where hostile local law enforcement agencies have busted medical cannabis dispensaries and charged their personnel with illegal distribution or sales.