The USA struggled in responding to the COVID-19 pandemic, but not all states struggled equally. Identifying the factors associated with cross-state variation in infection and mortality rates could help to improve responses to this and future pandemics. We sought to answer five key policy-relevant questions regarding the following: 1) what roles social, economic, and racial inequities had in interstate variation in COVID-19 outcomes; 2) whether states with greater health-care and public health capacity had better outcomes; 3) how politics influenced the results; 4) whether states that imposed more policy mandates and sustained them longer had better outcomes; and 5) whether there were trade-offs between a state having fewer cumulative SARS-CoV-2 infections and total COVID-19 deaths and its economic and educational outcomes. Data disaggregated by US state were extracted from public databases, including COVID-19 infection and mortality estimates from the Institute for Health Metrics and Evaluation's (IHME) COVID-19 database; Bureau of Economic Analysis data on state gross domestic product (GDP); Federal Reserve economic data on employment rates; National Center for Education Statistics data on student standardised test scores; and US Census Bureau data on race and ethnicity by state. We standardised infection rates for population density and death rates for age and the prevalence of major comorbidities to facilitate comparison of states' successes in mitigating the effects of COVID-19. We regressed these health outcomes on prepandemic state characteristics (such as educational attainment and health spending per capita), policies adopted by states during the pandemic (such as mask mandates and business closures), and population-level behavioural responses (such as vaccine coverage and mobility). We explored potential mechanisms connecting state-level factors to individual-level behaviours using linear regression. We quantified reductions in state GDP, employment, and student test scores during the pandemic to identify policy and behavioural responses associated with these outcomes and to assess trade-offs between these outcomes and COVID-19 outcomes. Significance was defined as p<0·05. Standardised cumulative COVID-19 death rates for the period from Jan 1, 2020, to July 31, 2022 varied across the USA (national rate 372 deaths per 100 000 population [95% uncertainty interval [UI] 364-379]), with the lowest standardised rates in Hawaii (147 deaths per 100 000 [127-196]) and New Hampshire (215 per 100 000 [183-271]) and the highest in Arizona (581 per 100 000 [509-672]) and Washington, DC (526 per 100 000 [425-631]). A lower poverty rate, higher mean number of years of education, and a greater proportion of people expressing interpersonal trust were statistically associated with lower infection and death rates, and states where larger percentages of the population identify as Black (non-Hispanic) or Hispanic were associated with higher cumulative death rates. Access to quality health care (measured by the IHME's Healthcare Access and Quality Index) was associated with fewer total COVID-19 deaths and SARS-CoV-2 infections, but higher public health spending and more public health personnel per capita were not, at the state level. The political affiliation of the state governor was not associated with lower SARS-CoV-2 infection or COVID-19 death rates, but worse COVID-19 outcomes were associated with the proportion of a state's voters who voted for the 2020 Republican presidential candidate. State governments' uses of protective mandates were associated with lower infection rates, as were mask use, lower mobility, and higher vaccination rate, while vaccination rates were associated with lower death rates. State GDP and student reading test scores were not associated with state COVD-19 policy responses, infection rates, or death rates. Employment, however, had a statistically significant relationship with restaurant closures and greater infections and deaths: on average, 1574 (95% UI 884-7107) additional infections per 10 000 population were associated in states with a one percentage point increase in employment rate. Several policy mandates and protective behaviours were associated with lower fourth-grade mathematics test scores, but our study results did not find a link to state-level estimates of school closures. COVID-19 magnified the polarisation and persistent social, economic, and racial inequities that already existed across US society, but the next pandemic threat need not do the same. US states that mitigated those structural inequalities, deployed science-based interventions such as vaccination and targeted vaccine mandates, and promoted their adoption across society were able to match the best-performing nations in minimising COVID-19 death rates. These findings could contribute to the design and targeting of clinical and policy interventions to facilitate better health outcomes in future crises. Bill & Melinda Gates Foundation, J Stanton, T Gillespie, J and E Nordstrom, and Bloomberg Philanthropies.