Mercury's high uncompressed mass density suggests that the planet is largely composed of iron, either bound within metal (mainly Fe-Ni), or iron sulfide. Recent results from the MESSENGER mission to Mercury imply a low temperature history of the planet which questions the standard formation models of impact mantle stripping or evaporation to explain the high metal content. Like Mercury, the two smallest extrasolar rocky planets with mass and size determination, CoRoT-7b and Kepler-10b, were found to be of high density.As they orbit close to their host stars this indicates that iron rich inner planets might not be a nuisance of the solar system but be part of a general scheme of planet formation. From undifferentiated chondrites it is also known that the metal to silicate ratio is highly variable which must be ascribed to pre-planetary fractionation processes. Due to this fractionation most chondritic parent bodies -most of them originated in the asteroid belt -are depleted in iron relative to average solar system abundances. The astrophysical processes leading to metal silicate fractionation in the solar nebula are essentially unknown. Here, we consider photophoretic forces. As these forces particularly act on irradiated solids, they might play a significant role for the composition of planetesimals forming at the inner edge of protoplanetary discs. Photophoresis can separate high thermal conductivity materials (iron) from lower thermal conductivity solids (silicate). We suggest that the silicates are preferentially pushed into the optical thick disk. Subsequent planetesimal formation at the edge moving outwards leads to metal rich planetesimals close to the star and metal depleted planetesimals further out in the nebula.