The American prison system was invented in the 1820s, along with the state-run orphanage, the state-run poorhouse, and the state-run insane asylum. Before the 1820s, these institutions were locally funded and operated. Then the reformers got their hands on these institutions and the taxes generated to operate them. (A well-researched book on this is David Rothman’s The Discovery of the Asylum .)
The Discovery of the Asylum: Social Order and Disorder in the New Republic, David Rothman, 1971, (New Lines in Criminology Series).