The delay is from the time of flight of light between Earth and Mars. Relays can only add additional processing time without shortening that, though they could potentially help with signal integrity. You also can't just freely place a relay between earth and Mars and have it stay between them — both planets are orbiting the sun and the relay also would be, with a period that doesn't match either planet.
Cannot tell if /s, but just in case this was serious: light takes between 3 and 22 minutes to travel from Mars to Earth and back, which means that ping cannot be less than between 6 and 44 minutes depending on orbits.
Robust caching would help but still be nothing like what we experience on Earth (particularly the interactive portions of the web like, say, HN).
Beyond line-of-sight (BLOS) communications are used all the time with satellites and other relays so people can communicate with others outside their immediate LOS. You need relays that extend the visibility of the planets with respect to each other. This is non-trivial, but not much harder than the work already going on to land things on Mars that requires (or desires) comms back to Earth.