In this paper we present a general equilibrium model where heterogeneous agents endogenously choose whether to become workers, consumers or entrepreneurs in order to analyze how limits on the leverage of banks affect real output. In our model tighter limits on the leverage of banks cause an increase in the spread between the interest rate that banks charge for loans and the interest rate that banks pay for deposits. A higher spread result in two types of distortions: First, firms with the same productivity will have different size. Second, productive firms will cease to exist, while nonproductive ones will enter. These distortions result in lower production.