Babe Ruth played when they had a154 game season. Willie Mays played about half his career when they had a 154 game season, and about half after the schedule expanded to the current 162 game season.
There are other factors too. Babe played all day games. Babe didn’t face multiple relief pitchers in one game the way hitters do now. Willie didn’t face ninth inning “closer”,relief pitchers, as baseball teams didn’t use relief pitchers that way when he played.
Ruth never faced a black (they called them negro) pitcher, or black outfielders, for that matter. Some of the best players in the country were not allowed to play against him,