It's no a question of punishment.
Well...it is, actually. It shouldn't be, but it is.
What it all comes down to is a question of the purpose of prison—and, indeed, of any court sentence.
As the excellent Illustrated Guide to Law lays out, any of our court sentences have five related purposes (and which purpose is most prioritized for a given sentence informs what the sentence is going to be like): Punishment, Deterrence, Rehabilitation, Removal and Retribution. At present, at least, America tends to focus heavily on Punishment and Retribution. That's what all the Tough On Crime laws are about: if you do something bad, you will be punished for it so that we feel like you've been hurt as much as the people you hurt. That's also partly about Deterrence.
Prison, specifically (and the death penalty, if you think about it), can usually serve the purpose of Removal—separating the criminal from the general population (aka "their potential victims," in many people's eyes, especially in the case of a registered sex offender). And, indeed, as some other people point out, if your real intention with a sex offender registry is to prevent them from coming into contact with potential victims, then the obvious solution is to just keep them locked up for life. Or kill them.
But I think most people would agree that, for most offenses that can land you on such a registry, that's too extreme. And all of this ignores the most utilitarian purpose of a court sentence for a crime: Rehabilitation. Helping the criminal to change whatever it is about themselves, or their life, that caused them to commit the crime in the first place. With a "classic" sex offender, this would have to include some kind of psychological component. Indeed, it might involve a lifetime of counseling, therapy, and/or drugs...but if we actually wanted to prevent people from committing these kinds of crimes again, rather than just hitting them on the head with the big freakin' hammer of the State from time to time when they reoffend (either in truth or merely by technicality, by breaking some condition of their registration), then we should pay a lot more attention to the mental health aspects of them than just thinking of the chiiiiiildren.