In the case of rival goods, the party consuming the product is easily linked to the party that will purchase the product. Whether the party purchases the product depends on whether the value obtained is at least as high as the price.
However, there are other goods that are largely nonrival. This means that several people might benefit from an item produced and sold in the market without diminishing the benefit to others, especially the party that actually made the purchase. For example, if a homeowner pays for eradication of mosquitoes around his house, he likely will exterminate mosquitoes that would have affected his neighbors. The benefit obtained by the neighbors does not detract from the benefit gained by the buyer. When benefits of a purchased good or service can benefit others without detracting from the party making the purchase, economists call the product a public good (public goods are discussed in Baye (2010)).
The difficulty with public goods is that the cost to create a public good by a seller may be substantially more than an individual buyer is willing to pay but less than the collective value to all who would benefit from the purchase. For example, take the cost of tracking down criminals. An individual citizen may benefit from the effort to locate and arrest a criminal, but the individual is not able or willing to hire a police force of the scale needed to conduct such operations. Even though the result of hiring a police force may be worth more to all citizens who benefit than what a company would charge to do it, since there are no individual buyers, the market will not be able to function and there is market failure.
As with the market failure for initial entrants with high startup cost, there is a potential agreement where all benefactors would be willing to pay an amount corresponding to their value that, if collected, would cover the cost of creating the good or service. The problem is that individuals would prefer to let someone else pay for it and be a free rider. So the inability of the market to function is a case of inefficiency.
In perfect competition, the optimal price to be charged is the marginal cost of serving another customer. However, in the case of public goods, the marginal cost of serving an additional benefactor can be essentially zero. This creates an interesting dilemma whereby the theoretical optimal pricing for the good is to charge a price of zero. Of course, that adds to the market failure problem because the cost of production of the good or service is not zero, so it is not feasible to operate a market of private sellers and buyers in this manner.
Usually the only way to deal with a public good of sufficient value is for the government to provide the good or service or pay a private organization to run the operation without charging users, or at least not fully charging users. This is how key services like the military, police protection, fire stations, and public roadways are handled. There may be some ability to charge users a modest fee for some services, but the revenue would not be sufficient to support a market served by private firms. For example, governments build dams as a means of flood control, irrigation, and water recreation. The agency that manages the dam may charge entry fees for boating on the lake or use of water released from the dam. However, the agency still needs to remain a public agency and likely needs additional finances from other public revenues like income or sales taxes to support its continued operations.
An interesting public good problem has emerged with the ability to make high-quality digital copies of books and music at very low marginal cost. When someone purchases a music CD (or downloads a file of commercial music) and then allows a copy to be made for someone else, the creation of the copy does not diminish the ability to enjoy the music by the person who made the initial purchase. Artists and producers claim that the recipients of the copies are enjoying the media products as free riders and denying the creators of the products full payment from all who enjoy their products, although there is some debate whether copying is a bona fide market failure concern.See Shapiro and Varian (1999).Nonetheless, publishers have pursued measures to discourage unauthorized copies, whether via legal prohibition or technology built into the media, or media players, to thwart the ability to make a clean copy.