Coronavirus disease 2019 (COVID-19) is exacerbating inequalities in the US. We build an agent-based model to elucidate the differential causal effects of nonpharmaceutical interventions on different communities and validate the results with US data. We simulate viral transmission and the consequent deterioration of economic conditions on socioeconomically disadvantaged and privileged populations. As found in data, our model shows that the trade-off between COVID-19 deaths and deaths of despair, dependent on the lockdown level, only exists in the socioeconomically disadvantaged population. Moreover, household overcrowding is a strong predictor of the infection rate. The model also yields new insights that fill in the gaps of our data analysis. While subsidisation narrows the socioeconomic gap in deaths of despair, the combination of testing and contact tracing alone is effective at reducing disparities in both types of death. Our results contribute to policy modelling and evaluation for reducing inequality during a pandemic.