Long term, most of it is inflation and survivorship bias when looking at the indexes.
In theory, retained earnings should increase the value of enterprises over time, but in reality most of that is stolen in the form of executive compensation, perks, and graft.
investing in equity must deliver on average a risk premium over credit. Otherwise the idea of capitalism would fail totally . Or in other words . No one would start any business if this would not be the case . And if no one would start a business it would again deliver a bigger risk premium.