They stop making it, and pay generic manufacturers not to.
https://www.nbcnews.com/business/business-news/drug-firms-st...
> Known as "reverse settlement payments," or "pay-to-delay" deals, the financial arrangements are a unique but common practice in the pharmaceutical industry. Essentially, they allow drug manufacturers in some instances to pay competitors not to manufacture generic versions of their products, thereby ensuring that they maintain patent protection for as long as possible.