This paper shows that if moral hazard leads to credit rationing, an appropriate usury law must raise social welfare. Under market clearing, a usury law is always beneficial if funds are inelastically supplied. When entrepreneurial heterogeneity is introduced, an improvement arises even when the supply of funds is elastic. These results apply also in costly state-verification models and diversionary models of the credit market. Finally, a usury law proves useful in eliminating low-yielding projects when some entrepreneurs display excess optimism.