This paper develops a unified theory of bank operations that integrates theories of financial intermediation, asset pricing, and production. In a simple dynamic model, banks maximize the present value of future profits generated through three categories of qualitatively distinct functions: (1) resolving information asymmetry in order to make loans, (2) providing transaction services, and (3) financing loans with borrowed funds. Risk determines the rate of return on the funds and in turn the discount rate for future profits. But risk affects the quantity of bank services generated in the first two functions only to the extent that assets of different risk require different amounts of information processing. The model thus coherently accounts for portfolio risk in measuring bank service output. It then recognizes that only functions (1) and (2) create bank value added, whereas the borrowed funds are merely an intermediate input in the provision of bank services. Furthermore, the funds and the production function for value added are separable in a bank's optimization solution. This model can resolve some long-standing debates in the literature on bank production, such as distinguishing between the input and output roles of deposits. It also provides a theoretical basis for measuring banking output in the National Income Accounts. This banking model implies a new measure of bank output that imputes the implicitly priced services as the part of net interest income that is free of risk-related returns on loanable funds. The new measure differs significantly from the ones commonly used, suggesting a need to reexamine the conclusions of a large body of empirical literature.