We analyze a model of R&D alliance networks where firms are engaged in R&D collaborations that lower their production costs while competing on the product market. We provide a complete characterization of the Nash equilibrium and determine the optimal R&D subsidy program that maximizes total welfare. We then structurally estimate this model using a unique panel of R&D collaborations and annual company reports. We use our estimates to study the impact of targeted versus nondiscriminatory R&D subsidy policies and empirically rank firms according to the welfare-maximizing subsidies they should receive.