We consider a liquid bearing gas bubbles in a porous medium. When gas bubbles are immovably trapped in a porous matrix by surface-tension forces, the dominant mechanism of transfer of gas mass becomes the diffusion of gas molecules through the liquid. Essentially, the gas solution is in local thermodynamic equilibrium with vapor phase all over the system, i.e., the solute concentration equals the solubility. When temperature and/or pressure gradients are applied, diffusion fluxes appear and these fluxes are faithfully determined by the temperature and pressure fields, not by the local solute concentration, which is enslaved by the former. We derive the equations governing such systems, accounting for thermodiffusion and gravitational segregation effects which are shown not to be neglected for geological systems-marine sediments, terrestrial aquifers, etc. The results are applied for the treatment of non-high-pressure systems and real geological systems bearing methane or carbon dioxide, where we find a potential possibility of the formation of gaseous horizons deep below a porous medium surface. The reported effects are of particular importance for natural methane hydrate deposits and the problem of burial of industrial production of carbon dioxide in deep aquifers.