You’re thinking of Alferd Packer, and much of the story is a popular myth.
Here’s the true story: In 1873, Alferd Packer and five other residents of Colorado went prospecting. They got lost in a snowstorm and their provisions ran out. When authorities came upon the scene months later, the five others had been killed, and one of them had been partially roasted and eaten. Packer was convicted of murder and cannibalism.
That part is true. Now, here’s where the legend kicks in: At the end of Packer’s trial, the judge supposedly exclaimed,
“Stand up, you man-eating son of a bitch, and receive your sentence. There were seven Democrats in Hinsdale County, but you, you voracious, man-eating son of a bitch, you ate five of them. I sentence you to be hanged by the neck until you’re dead, dead, dead, as a warning against reducing the Democratic population of the state.”
Back to reality now. Packer served seventeen years and lived out the rest of his life as a semi-recluse (and, some say, a vegetarian), spending some of his time hanging around the Denver Post building as an unofficial security guard (this may have been out of gratitude since a Denver Post reporter had been responsible for getting his sentence reduced).
Incidentally, a century later, the students at Boulder University voted to name the school cafeteria the “Alferd Packer Memorial Grill.” Its most popular menu item has been the El Canibal Burrito.