RALEIGH, N.C. (WNCN) — North Carolina spends more than $50,000 a year for every prisoner behind bars, a study found.

The study released Tuesday by USAFacts put the state in the lower half nationally when it comes to per-prisoner spending in 2020, the most recent data available from the Bureau of Justice Statistics.

North Carolina ranks No. 22 at $52,882 per prisoner that year — more than 2 1/2 times less than the top-spending state, Wyoming, which spent $135,978 for every person behind bars.

Mississippi spent the least that year, at just $18,408 per prisoner.

The study says the money spent by the states’ corrections departments mostly goes toward prison operations and the salaries of correctional officers, with some states also paying for rehabilitation programs, drug treatment or juvenile justice plans.

The average corrections officer in North Carolina made $41,520 that year, roughly half of the pay rate in California ($81,170).

USAFacts is a nonprofit organization founded in 2017 by former Microsoft CEO Steve Ballmer that makes government data easier to access and understand.