Preferences and beliefs in ingroup favoritism