Legitimacy and the cost of government