US spending on prescription drugs has been growing rapidly, prompting calls for government intervention to slow the upward trend. But any intervention should be predicated on a clear understanding of the economic forces that drive price increases, and the parties responsible for them. We collect gross and net profit data from the 2015 US Securities Exchange Commission regulatory filings of the largest publicly traded companies in the pharmaceutical distribution system, and use them to describe the flow of funds across the drug distribution system to understand how much each sector profits from its transactions. Gross (net) margins average 71 percent (26%) for manufacturers, 22 percent (3%) for insurers, 20 percent (4%) for pharmacies, 6 percent (2%) for pharmacy benefit managers and 4 percent (0.5%) for wholesalers. These margins imply that for every $100 spent at retail pharmacies, about $17 compensates for direct production costs, $41 accrues to the manufacturer ($15 of which is net profit), and $41 accrues to intermediaries in the distribution system: wholesalers, pharmacies, pharmacy benefit managers and insurers (with $8 of net profit split among them). The allocations differ depending on whether the drug is generic or branded. Manufacturers have higher gross profit margins for branded drugs and intermediaries have higher gross profit margins for generic drugs. Gross margins on generic drugs are lower for manufacturers (50%), and much higher for pharmacies (43%). More than $1 in every $5 in spending on prescription drugs goes towards profits of firms in the pharmaceutical distribution system. While the current analysis cannot say definitively whether any sectors make excessive profits, greater scrutiny of pricing policies of each sector and more competition throughout the distribution system is warranted.