Civil societies function because people pay taxes and make charitable contributions to provide public goods. One possible motive for charitable contributions, called "pure altruism," is satisfied by increases in the public good no matter the source or intent. Another possible motive, "warm glow," is only fulfilled by an individual's own voluntary donations. Consistent with pure altruism, we find that even mandatory, tax-like transfers to a charity elicit neural activity in areas linked to reward processing. Moreover, neural responses to the charity's financial gains predict voluntary giving. However, consistent with warm glow, neural activity further increases when people make transfers voluntarily. Both pure altruism and warm-glow motives appear to determine the hedonic consequences of financial transfers to the public good.