I am far from an expert on this topic. What I'm thinking of is the difference between say, my sister-in-law who was poor, 16, addicted to drugs since birth and was along for the ride when someone got murdered, then tried as an adult and locked up for 5 years. Or a 20-year-old brother-in-law selling drugs who illlegally has a gun he never uses for protection. Or guys robbing people for money... whatever. That's different than someone murdering somebody, along with having multiple other charges under their belt--that's a pattern of behavior, not a bad decision. Particularly when you start to consider his age. A 20-year-old is basically still a kid; heck, you could still be in juvie at that age.
At a certain point when you're hurting other people, you probably can be rehabilitated, but the potential benefit you offer society isn't worth the risk in allowing you out of the justice system for a long, long time depending on the crime. I'm not an expert and don't want to try to qualify who and when... but "bad" person probably wasn't the right descriptor.
Out of the 5 of my siblings-in-law that are felons, I would say that three are clearly "rehabilitated." One became an accountant after starting classes in lockup, and the other 2 own a mechanic shop together where they work on foreign cars. So the system works for some people, but it takes A LOT of support from family and friends during and after your stay in prison to make it happen. The social pressures to fail and commit more crimes are immense.
Now if we're going to talk about how the law treats felons outside of prison? Don't get me started. The parole system is ridiculous. The cost of paying parole officers, and the clowns that work in that system as a power trip can rot in a worse hell than the people they supervise. Housing laws that discriminate against felons have got to be a reason for half the recidivism rates in this country. Taking 1/3 of the money families send to prisoners in lockup is stupid. The cost of basic necessities like shoes in prison is stupid. I can't even start with how bad it is.