He got popped for PEDs when he joined the Red Sux in 2003 prior to when MLB officially implemented PED testing. It was basically a trial run, so he was never punished. He then blamed it on tainted supplements, then MLB said the tests were unreliable in an attempt to justify not punishing him.
Then one of the executives of the Boston Red Sux led an investigation into steroid usage in MLB and surprise surprise none of the Red Sux players were named in the report. Players from a number of teams around the league were named, but the two teams that contained the most players named in the report were the New York Yankees and the Baltimore Orioles which happen to both be in the same division as the Red Sux. Basically, they could win the division so they led an investigation into their opponents while they continued to cheat.
Fast forward to MLB's recent handling of the Astro's cheating, and they haven't penalized any of the players for what MLB itself calls a player driven act on the part of the 2017 WS "champions". And MLB has an open investigation against the 2018 WS "champions" Boston Red Sux for basically the same thing the Astros got caught doing the previous year. And, oh yeah, one of the guys that was proven to be heavily involved in the Astros cheating, Alex Cora, went from the Astros bench coach in 2017 to the Red Sux manager in 2018, but he probably stopped cheating, right? Despite that, MLB hasn't announced findings from the investigation into the Red Sux most likely because they don't want to admit that yet another WS title is tainted for a second year in a row. Then the Astro were very likely using buzzers in the 2019 season when they went to, and thankfully lost, the WS. Yet MLB has somewhere completed that investigation, despite still scratching their heads with regard to the 2018 investigation, and announced they found no evidence of the Astros cheating in 2019.
Basically, the league is covering up a lot of cheating and they've been doing it for a long time, and David Ortiz' cheating crossed paths with that back in the day.