And during most of that time, they were still protected by 'data exclusivity' which means that any generic producer could not get approved without doing their own clinical trials, until 8 years had passed.
So they gave up some period of exclusivity in return for being able to charge a higher price when they still had a monopoly.