A photon takes longer to travel from the core of the Sun to the surface than the Sun to the Earth! This is because when a photon is released, it is absorbed by another atom and then released in another random direction. But, when the photon goes from the Earth to the Sun, it is travelling at the speed of ligt because the only atoms that will absorb it are on Earth or another planet!