We consider a moral hazard economy in banks and production to study how incentives for risk taking are affected by the quality of supervision. We show that low interest rates may generate excessive risk taking. Because of a pecuniary externality, the market equilibrium may not be optimal and there is a need for prudential regulation. We show that the optimal capital ratio depends on the macro-financial cycle, and that, in presence of production externalities, it should be complemented by a constraint on asset allocation. We show that the political process tends to exacerbate excessive risk taking and credit cycles.