States and companies have started investing very differently when it comes to the billions of dollars they are safeguarding for workers’ retirement.