Studio Wanted One of the Leads to Live in Order to have a Franchise...
https://variety.com/2023/film/news/martin-scorsese-warner-bros-the-departed-franchise-1235735509/
Scorsese says this contributed to the end of his relationship with Warner Bros.
I prefer the ending in the original, which allowed the mobster-posing-as-a-cop to live, though I can't say I remember any of the sequels. I thought it was pretty Hollywood to end with gunfire and kill off the bad guy. They still had a franchise in mind because they wanted to make a sequel with Wahlberg. I heard Wahlberg and the film's writer got along well, which seemed to be confirmed by their collaboration on a remake of The Gambler.