Murder is considered wrong because of empathy, or right because of lack of empathy. It was "okay" for someone to kill a black person in America when people didn't have empathy for black people, but it wasn't "okay" for someone to kill a white person, because people did have empathy for white people. It was easy to put themselves in the shoes of the white person who was murdered and to think, "it would be wrong if done to me, so it was wrong when done to this person". But for a long time, if it was a black person, or a Native American, or an immigrant, they weren't part of the group that it was easy to empathize with, and therefore, most people were willing to overlook such things. Basically, since they were not black people (or whichever out-group you prefer), they did not feel that killing a black person was the same as killing a white person.
Even today, we still have problems with empathy between various groups in America. Yet I think there is a direct correlation between how empathetic a person is and how likely they are to commit a crime that harms someone else regardless of punishment, even if it is a crime they could otherwise get away with.