Identity, Collective Beliefs, and the Allocation of Resources