Reduction of CM elliptic curves and modular function congruences