Diffusion of carbon from ferrite to cementite in the eutectoid transformation
Diffusion is perhaps more complicated than initially taught. Yes, all things being equal you will get diffusion from regions of high concentration to regions of low concentration. 

But, in the case you mention, all things are not equal - there is a phase change occurring, and that means that there are chemical potential gradients as well as concentration gradients. Now you have an additional driving force for motion of impurities as they prefer to be in the phase with a lower Gibbs free energy.