The Torah teaches that a man who kills someone accidentally – manslaughter as opposed to murder – is relocated to an עיר מקלט – a city of refuge. He must remain there for the rest of his life or until the Kohen Gadol dies. A relative of the victim is appointed to pursue the murderer, and if he ever meets the killer outside the עיר מקלט, he is meant to avenge his relative and kill the man.
The Steipler Gaon explains that the עיר מקלט saves the man, but is still a punishment.
The עיר מקלט saves the killer from being hunted down by the person who sets out to avenge his family member; but even under circumstances where the avenger would not kill him, he must still flee anyway as part of the punishment. He needs to stay there until he dies, and is buried there. Being buried there and not where his family choose is also part of the punishment – independent of someone chasing him.
The Gemara in Sanhedrin records that if no relative is willing to avenge the deceased, then the Beis Din must appoint someone, a stranger. Clearly then, this law is not predicated on revenge either.
The cities of עיר מקלט were publicly owned – it is where people of Levi lived – the teachers of Bnei Yisrael. Being confined there specifically would mean he would learn from them, and correct his life and mistakes that caused his predicament. If he ever left, he would not be the same man who walked in – he would emerge enlightened.
The Beis Din needs to ensure an avenger is appointed because people, and society must always be held accountable for actions. No one can get away with crimes. The Torah is explicit that he cannot bribe his way out – the killer will stay until the end. There must always be fair justice.