Magnetic field evolution and equilibrium configurations in neutron star cores: the effect of ambipolar diffusion