When the Seattle Mariners play their home opener Thursday, some of the dirt on the infield will have come from 2,500 miles away, in Pennsylvania.

Baseball teams used to get any old dirt for infields and pitchers mounds, scooping soil from a nearby hillside or riverbed. Now, egged on by specialist baseball-soil suppliers, they apply nearly as much science to the dirt as they do to the pitching rotation. They demand just the right mixture of sand, clay and silt to provide a smooth, predictable surface—even if that means dirt is no longer dirt cheap.

“The price isn’t an object for me,” said Larry DiVito, head groundskeeper of the Minnesota Twins, who also buys dirt shipped from Pennsylvania. “It’s about consistency and knowing what you’re getting.”

Major league-quality mixes can cost $80 to $100 a ton, before freight charges. That is around four times what Mr. DiVito figures he would pay for ordinary screened dirt that hasn’t been formulated for baseball. Replacing just the non-grassy part of a major league infield can cost as much as $50,000.

Smooth, resilient infields reduce the risk of a bad hop that might knock out an infielder’s teeth. They can make it less likely players will get their cleats stuck in the soil and twist an ankle when rounding a base or pivoting to make a throw.