Differences in resource availability or inequality of wealth are common both in nature and in human societies. Here the authors find that such inequality facilitates cooperation when the generation of public goods is inefficient, but hinders cooperation when the efficiency of joint actions is high.