How was America transformed into a country of both opportunity and economic inequality during the gilded age?