Sammy Sosa wasn’t a Hall of Famer. He had a Hall of Fame level decade, but generally the voters want someone to be better longer than Sosa was.
For example, Larry Walker - who was just admitted in the most recent class - and Sammy Sosa both had their peak bWAR decade during the exact same time period, 1993-2002. Walker put up 51.2 bWAR during that time frame and Sosa put up a slightly superior 54.2 bWAR. The difference is that in seasons outside that 10-year peak, Walker put up 21.5 additional bWAR, while Sosa put up only 4.4.
You can point to very similar other examples with Derek Jeter, Edgar Martinez and Chipper Jones, among other recent inductees.
Of the recent inductees, Sosa’s career is probably most similar to Vlad Guerrero’s, but Vlad was slightly better both inside and outside his peak, doesn’t have the taint of steroids around him, and for whatever reason was generally more respected and popular among the baseball press than Sosa was.