The Hall effect of an inhomogeneous magnetic field in mesoscopic structures