This paper develops a theoretical model of trading in the federal funds market that captures characteristics of discount window borrowing and the federal funds market during the first year of the financial crisis, including the narrowing of the spread between the discount rate and the target rate; the increased incidence of high-rate trading; and the decline in participation in the federal funds market. The model shows that differences in stigma of borrowing from the discount window across banks can cause the federal funds rate to rise, even when the spread between the discount rate and the target rate narrows. The model is then evaluated using both aggregate and institution-level data. The data suggest that in aggregate, federal funds volume brokered at rates above the primary credit rate and discount window borrowing both increased during the first stages of the crisis. Bank-level data suggest that institutions that went to the discount window paid lower rates in the federal funds market than banks that did not. This effect became stronger as the spread between the primary credit rate and the target rate narrowed, coincident with the intensification of the financial crisis.