Investments in scientific and technological knowledge depend on the level of excludability. In this study, based on a game-theoretic analysis of discrete public goods, it is shown that pure excludability and pure non-excludability are equally inefficient, whereas the socially optimal level of excludability is a function of the benefits and costs of the knowledge investment, where it lies between the two extremes. This result illustrates the challenges and dangers of intellectual property rights policy. Allowing for voluntary R&D cooperation, the optimal level of excludability becomes an interval, typically between the two extremes. Thus, R&D cooperation can make intellectual property rights perform more efficiently and alleviate the problem of optimal policy design. This also demonstrates that knowledge commons can be provided efficiently through voluntary cooperation when imperfect property rights give partial excludability. Therefore, R&D cooperation and intellectual property rights should be considered as complementary rather than as separate and alternative policy measures.