RAH certainly endorsed lots of corporal punishment in ST but the only time capital punishment comes up that I recall was with a deserter who then killed a child. That book gets a lot of shit, some justified, and God knows RAH loved his soapboxing but ST's discussion long ass lecture on crime mostly focuses on juvenile delinquents in 'the past' e.g. his present and near future, and the book is written for juveniles as well. They were clearly pretty hard on crime but people analyze the hell out of that book, and RAH isn't a worse soapboxer then a lot of authors.
I simply agree with his opinion on imprisonment. I have never understood the thought process that inprisoning someone for 30 years and then releaseing them can accomplish anything positive.