Importance: Mental health disorders are prevalent yet undertreated health conditions in the US. Given perceptions about the potential effect of cannabis on individuals with mental health disorders, there is a need to understand the association of cannabis laws with psychotropic use., Objective: To investigate the association of medical and recreational cannabis laws and dispensary openings with the dispensing of psychotropic medications used to treat mental health disorders in the US., Design, Setting, and Participants: This cross-sectional study of 10 013 948 commercially insured patients used a synthetic control method to examine the association of cannabis policies with prescribing. Data on all patients dispensed prescriptions for each of the 5 classes of psychotropic medications from January 1, 2007, to December 31, 2020, were extracted from Optum's deidentified Clinformatics Data Mart Database. Statistical analysis was performed from September 2022 to November 2023., Exposures: The 4 exposure variables measured were whether medical or recreational cannabis laws were in effect and whether medical or recreational cannabis dispensaries were open in each state and calendar quarter., Main Outcome and Measures: One measure of the extensive margins of dispensing and 2 measures of the intensive margins of dispensing were constructed for 5 medication classes (benzodiazepines, antidepressants, antipsychotics, barbiturates, and sleep medications)., Results: The primary sample (the benzodiazepine sample) included 3 848 721 patients (mean [SD] age, 46.1 [11.4] years; 65.4% women; 53.7% aged 35-54 years). Medical cannabis laws were associated with a 12.4% reduction in the benzodiazepine fill rate (average treatment effect on the treated [ATT], -27.4; 95% CI, -14.7 to 12.0; P = .001), recreational cannabis laws were associated with a 15.2% reduction in the fill rate (ATT, -32.5; 95% CI, -24.4 to 20.1; P = .02), and medical cannabis laws were associated with a 1.3% reduction in the mean number of benzodiazepine fills per patient (ATT, -0.02; 95% CI, -0.02 to 0.02; P = .04). Medical dispensaries were associated with a 3.9% reduction in mean days' supply per benzodiazepine fill (ATT, -1.7; 95% CI, -0.8 to 0.6; P = .001), while recreational dispensaries were associated with a 6.2% reduction (ATT, -2.4; 95% CI, -1.0 to 0.9; P < .001). Medical cannabis laws were associated with a 3.8% increase in antidepressant fills (ATT, 27.2; 95% CI, -33.5 to 26.9; P = .048), and medical dispensaries were associated with an 8.8% increase (ATT, 50.7; 95% CI, -32.3 to 28.4; P = .004). The mean number of antipsychotic medication fills per patient increased by 2.5% (ATT, 0.06; 95% CI, -0.04 to 0.05; P = .02) after medical cannabis laws and by 2.5% (ATT, 0.06; 95% CI, -0.04 to 0.04; P = .02) after medical dispensary openings. Findings for the other drug classes showed substantial heterogeneity by state and direction of association., Conclusions and Relevance: This cross-sectional study of commercially insured patients suggests that there may have been meaningful heterogeneous associations between cannabis policy and state and between cannabis policy and drug class (eg, decreases in dispensing of benzodiazepines but increases in dispensing of antidepressants and antipsychotics). This finding suggests additional clinical research is needed to understand the association between cannabis use and mental health. The results have implications for patient substance use and mental health-related outcomes.