From BR Bullpen
The foul line is a line made of lime that extends from the corners of home plate, past first and third base, to the foul poles. Although they are called foul lines, the lines themselves are entirely in fair territory, and they are occasionally called fair lines to emphasize this point.
Balls are judged to be fair or foul depending on their position in the field, both relative to the foul lines and first or third base. A ball that passes first or third base on the fly is judged fair or foul based on where it lands or is touched by a fielder before landing. Balls that fall (or are touched) on or between the foul lines are fair, while those that fall (or are touched) outside the lines are foul.
Balls that land (or are touched) before passing first or third base are judged fair or foul based on their positions when they either pass first or third base or when they are touched by a fielder, whichever comes first. Balls that neither pass a base nor are touched by a fielder are judged by where they come to a stop. Because of this distinction, infielders will sometimes allow balls near the foul line to continue rolling slowly in the hopes that they will roll foul, and then touch them as soon as they do.