On accretion from a medium containing a density gradient