Measurement of the $\phi \to \pi^0 e^+e^-$ transition form factor with the KLOE detector