Tony Greenwald and Thomas Pettigrew argue that it's in-group favoritism rather than hostility to outgroup individuals which drives some parts of discrimination. An example:
Take this hypothetical scenario: When conducting reviews of two employees, a manager finds they both fall between two performance categories. The manager gives a higher category to the employee whose child is friends with the manager’s child, leading to a promotion and salary raise, while the other employee receives a smaller raise and no promotion.
Was the manager consciously discriminating against the second employee? Or did she simply give a boost to someone to whom she had an “ingroup” connection?
“Your ‘ingroup’ involves people that you feel comfortable with, people you identify with,” Greenwald explained. “We usually think first of demographic characteristics like age, race, sex, religion and ethnicity as establishing an ingroup, but there are also ingroups based on occupation, neighborhood and schools attended, among other things. Outgroups are those with whom you don’t identify.”
The idea is that people feel most comfortable with people most like themselves, and that's why race, sex, religion and other aspects matter.
I haven't been able to read the overview (the study) yet (keep getting error messages), but the question what drives discriminatory behavior is certainly something I've researched quite a bit. The differences can vary greatly, at least in theory, from outright hatred and disgust towards certain types of individuals to social norms and codes which are followed unconsciously and without any actual intent to harm or help anyone.
That's a very bare-bones summary of the various theories. But "nepotism," interpreted as favoring those who are very close to the decision-maker (promoting the no-good nephew or niece), looks like the closest theory to the one Greenwald and Pettigrew promote.
Nepotism (or whatever you wish to call this) looks like the flip-side of discrimination based on negative views or discriminatory social norms. But it is usually interpreted as somewhat narrower, because the number of people "most like ourselves" can be defined as a fairly small group in some interpretations. The term "nepotism" refers to favoring one's relatives over others, after all.
It looks like Greenwald and Pettigrew expand the idea of "most like ourselves" or the definition of "ingroup" to people of the same gender and/or race. I'm not convinced that this expansion works, though I agree that preferential treatment for cousins, college buddies etc. is common. But as stated, I haven't read the study yet.
Still, if you notice that in my previous post I discussed a case where female customers gave lower ratings to female client service representatives than male customers, it's clear that the favoritism theory based on giving preferential treatment to those we identify with cannot be the only explanation or probably even the main explanation of what's going on there.*
My guess is that the motives for the way we behave are complicated, that social norms matter, including outdated social norms, and that the role of ingroup motives in discrimination is not unimportant but is unlikely to be sufficient to account for the choices people make. I do agree that discrimination is probably less often based on outright hostility or hatred than on more fuzzy motives and that much of it is unconscious.
-----
*Another example of this comes from a 2012 study of faculty mentoring where the professor's race or gender didn't affect the reduction in mentoring female students and minority male students received, with the possible exception of Chinese professors who were somewhat more likely to wish to meet a student with a Chinese name. A better explanation in this case, too, looks to me to be the social norms theory, the idea that certain types of people "belong" to the top, that certain types of people exude competence while other types do not and so on.