In current models used to interpret exoplanet atmospheric observations, the planetary mass is treated as a prior and is measured/estimated independently with external methods, such as radial velocity or transit timing variation techniques. This approach is necessary as available spectroscopic data do not have sufficient wavelength coverage and/or signal-to-noise to infer the planetary mass. We examine here whether the planetary mass can be directly retrieved from transit spectra as observed by future space observatories, which will provide higher quality spectra. More in general, we quantify the impact of mass uncertainties on spectral retrieval analyses for a host of atmospheric scenarios. Our approach is both analytical and numerical: we first use simple approximations to extract analytically the influence of each atmospheric/planetary parameter to the wavelength-dependent transit depth. We then adopt a fully Bayesian retrieval model to quantify the propagation of the mass uncertainty onto other atmospheric parameters. We found that for clear-sky, gaseous atmospheres the posterior distributions are the same when the mass is known or retrieved. The retrieved mass is very accurate, with a precision of more than 10%, provided the wavelength coverage and signal-to-noise ratio are adequate. When opaque clouds are included in the simulations, the uncertainties in the retrieved mass increase, especially for high altitude clouds. However, atmospheric parameters such as the temperature and trace-gas abundances are unaffected by the knowledge of the mass. Secondary atmospheres, expected to be present in many super-Earths, are more challenging due to the higher degree of freedom for the atmospheric main component, which is unknown. For broad wavelength range and adequate signal-to-noise observations, the mass can still be retrieved accurately and precisely if clouds are not present, and so are all the other atmospheric/planetary parameters. When clouds are added, we find that the mass uncertainties may impact substantially the retrieval of the mean molecular weight: an independent characterization of the mass would therefore be helpful to capture/confirm the main atmospheric constituent.