The canonical approach to measuring private and social returns to R&D assumes diffusion through spillovers. We develop a general framework that allows R&D to diffuse through both spillovers and voluntary technology transfers. To operationalize the framework, we create a data set of interactions in the market for technology between publicly held US firms. We use changes in tax incentives for R&D to identify causal effects. Taking market channels into account decreases the observed difference between social and private returns to R&D as compared with the canonical approach. The analysis suggests significant gains from trade in markets for technology.