We analyze the classic problem of sustaining trust when cheating and leaving trading partners is easy, and outside enforcement is difficult. We construct equilibria where individuals are loyal to smaller groups– communities– that allow repeated interaction. Hierarchies provide incentives for loyalty and allow individuals to trust agents to extent that the agents are actually trustworthy. We contrast these with other plausible institutions for engendering loyalty that require inefficient withholding of trust to support group norms, and are not robust to coalitional deviations. In communities whose members randomly match, we show that social mobility within hierarchies falls as temptations to cheat rise. In communities where individuals can concentrate their trading with pre-selected members, hierarchies where senior members are favored for trade sustain trust even in the presence of proximate nonhierarchical communities. We link these results to the emergence of trust in new market environments and early human societies.