In this paper I ask whether a central bank policy of providing liquidity to banks during panics can prevent bank runs without causing moral hazard. This kind of policy has been widely advocated, most notably by Bagehot (1873). To analyze such a policy, I build a model with three key features: 1) bank panics can occur in equilibrium, 2) there can be moral hazard, 3) the central bank can create money which is willingly held. I show that a particular central bank repurchase policy provides liquidity to the banking system and can prevent bank panics without moral hazard problems. I also show that a deposit insurance policy, while preventing runs, creates moral hazard problems.