> prisons are not real punishment
I think Aaron Swartz would disagree.
> punishing them with the clear intention of feeling good in some way
This plays some role, but I'd say the biggest reason people give in favor of having prisons is rational: Deterrence. If crimes aren't punished, what stops people from stealing when they want something they can't afford? What stops the strong from beating up the weak for fun, for profit, or as a way to resolve disputes in their favor? What stops the weak from shooting the strong because they finally get tired of being beaten up? What reason is there to adhere to contracts and agreements necessary for effective commerce if it would be more beneficial to one party to break them?
If you agree that punishment is necessary, but prison is somehow deficient as a punishment, what's the alternative? The punishment has to be sufficiently undesirable to cause most people to avoid crime in order to avoid the punishment. In addition, if it's going to be implemented in the US, it can't be cruel and unusual punishment since that is strictly Constitutionally prohibited, and if it's going to be implemented in a relatively free and democratic society, it has to show respect for generally accepted human rights principles. This excludes solutions like lashing, waterboarding, more extreme torture, massive expansions of the death penalty (I believe England as late as the 1500's would hang homeless children for stealing clothes to keep warm in the winter), or collective punishment (punishing someone else instead of or in addition to a criminal, e.g. many authoritarian regimes are willing to punish opponents by jailing, torturing, and/or killing their innocent friends, relatives, and children).
I do think that US criminal justice could be better. Currently many crimes are punished too harshly, sometimes sentences are inconsistent, current implementation of plea bargaining sometimes leads to terrible injustices, public defenders are woefully underfunded, the education system doesn't do a good job of covering these issues, and life is far too difficult for people after a felony conviction (discrimination against workers with felony records is legal and widespread; this sort of discrimination shouldn't be illegal, but culturally we need to be more willing to let people have second chances).