Moral hazard, monitoring costs, and optimal government intervention