We study the economic and political effects of competition by state-owned firms, leveraging the decentralized entry of public pharmacies to local markets in Chile around local elections. Public pharmacies sell drugs at a third of private pharmacy prices, because of a stronger upstream bargaining position and downstream market power in the private sector, but are also of lower quality. Exploiting a field experiment and quasiexperimental variation, we show that public pharmacies affected consumer shopping behavior, inducing market segmentation and price increases in the private sector. This segmentation created winners and losers, as consumers who switched to public pharmacies benefited, whereas consumers who stayed with private pharmacies were harmed. The countrywide entry of public pharmacies would reduce yearly consumer drug expenditure by 1.6 percent, which outweighs the costs of the policy by 52 percent. Mayors that introduced public pharmacies received more votes in the subsequent election, particularly by the target population of the policy.