Stochastic theory of transport in inhomogeneous media