The Morphology of Distant Cluster Galaxies. II. HST Observations of Four Rich Clusters at z ≃ 0.4