The benefit is social cohesion. That may not seem like a logical leap until you realise that at it's heart, most hate starts from identifying someone as different.
We are biologically driven to feel discomfort around people who are different to us. This drives us towards people who are similar to us, which reduces conflict, which allows us to work together to achieve things as a group (and on a larger level, as a society).
In earlier times, this drive helped ensure survival, and the best chance of that was as part of a small family / group / clan / tribe, where social cohesion was very necessary.