The closer you are to someone the more likely you are to laugh with them and not at them. When someone is telling jokes about another race or religion and there are no people from that race or religion in the room with them, then they are more likely laughing at them than with them.