This was a feudal dynasty, so it was naturally impossible for everyone to be equal. 'All are equal before the eyes of the law' was a concept that only existed in novels and plays.
A prince killing a commoner faced a different punishment from a commoner who killed a commoner, let alone a lowly prostitute who had been bought with money. A nobleman would not have to pay with his life for killing a slave, but it wasn't that he could escape completely unscathed. Even if the slave had signed an irrevocable contract, a nobleman would have to be punished with 80 strokes of the cane for killing a slave.
Although it was only 80 strokes, what about if he had killed eight or ten?
When it reached a certain number of people, the government office could sentence him in the name of inhumanity. In that case, a county official could have the culprit exiled.