According to the black sheep effect, someone who is socially undesirable is liked less if they belong to our group (an ingroup member) than if they belonged to a different group to which we do not belong (an outgroup member).
The black sheep effect is a form of ingroup bias or ingroup favoritism: by derogating unlikable ingroup members, people protect (and thus promote) the positive image and identity of the ingroup as a whole.