The relative yields of gamma mesons produced in pp and Pb-Pb collisions at root s(NN) = 5.02 TeV and reconstructed via the dimuon decay channel are measured using data collected by the CMS experiment. Double ratios are formed by comparing the yields of the excited states, gamma(2S) and gamma(3S), to the ground state, gamma(1S), in both Pb-Pb and pp collisions at the same center-of-mass energy. The double ratios, [gamma(nS)/gamma(1S)](Pb-Pb)/[gamma(nS)/gamma(1S)](PP), are measured to be 0.308 +/- 0.055(stat) +/- 0.019(syst) for the gamma(2S) and less than 0.26 at 95% confidence level for the gamma(3S). No significant gamma(3S) signal is found in the Pb-Pb data. The double ratios are studied as a function of collision centrality, as well as gamma transverse momentum and rapidity. No significant dependencies are observed.