First, the middle-men who negotiate and develop the formularies for insurance companies, called pharmacy benefit managers, get a cut of the reduced cost. So they make more money from a drug being $1000 and rebated to $100 than they would from the drug just being $100 all along. The pharma company makes the same amount per unit, $100, but they are much more likely to get onto an insurance plan if they go through the sham of marking it up to $1000 and then cutting it down.
Secondly, extremely inflated list prices that get rebated down simply mean that it becomes that much more critical for patients to pay for an insurance plan, because it is increasingly untenable to be without one.
These "negotiations" that PBMs do have been closely guarded "trade-secrets" but pharma companies have in recent congressional hearings have essentially said this is the situation. This seems to be supported by the fact that in their financial reports for products like insulin, the actual profit per unit has largely kept pace with inflation over the last few decades, despite the listed price of insulin skyrocketing during the same timeframe.
This is pretty much entirely the result of there not being a non-profit seeking government provided insurance option available to all in the US. If there is a reasonable alternative to private insurance that isn't engaging in the insurance cartel, no one is forced to use private insurance and the private insurers are actually forced to compete in a market. Completely socialized medicine isn't required, we simply need a Medicare-for-all option available to destroy the anti-competitive behavior that currently exists in the US insurance market.