If the ball hits in behind home plate and then comes in fair territory is it fair or foul?

The answer to this lies in the definition of a foul ball listed in Rule 2 of the MBL rule book. A FOUL BALL is a batted ball that settles on foul territory between home and first base, or between home and third base, or that bounds past first or third base on or over foul territory, or that first falls on foul territory beyond first or third base, or that, while on or over foul territory, touches the person of an umpire or player, or any object foreign to the natural ground. The operatve word here is "settled". A ball is not considered to be foul until it touches something in foul territory like a player or umpire or fence, or until it has settled. So if in your example, all the ball touched behind the plate was dirt and then it bounces out and settles in fair territory, that is a fair ball.