Caffeine is a legal stimulant so it isn't banned. And yes, players use a TON of caffeine because it also enhances performance, just to a lesser degree than amphetamines.
If you read the drug agreement you'll see that drugs like weed and heroin are grouped separately as drugs of abuse. Major league players aren't tested for them unless there is probable cause. Amphetamines, on the other hand, are not in that group and players are tested for them in the same way that they are tested for steroids--everyone in spring and then some players randomly throughout the season.