This paper studies how the social structure of village economies affects policy implementation by local agents. We randomly select one of two viable candidates to deliver an agricultural extension program in rural Ugandan villages. We show that delivery agents favor their own social ties over ex-ante identical farmers connected to the other (non-selected) candidate and that this is inconsistent with output maximization or targeting the poorest. Favoritism disappears when the potential delivery agents belong to the same social group. Using the randomised allocation of the program across villages, we show how unobserved social structures explain the variation in delivery rates and program effectiveness that we often observe in the data.