Code and data for this blog post.
Pupil spending data from the U.S. Census (see table 8). Data is from 2013.
Prison data from vera.org (see figure 4). Data is for fisical year 2010.
Note that data are from different years, and thus differen state budgets and political tendencies, so proceed with caution.