Adhesion of nanoparticles to polymer films plays a key role in various polymer technologies. Here we report experiments that reveal how silica nanoparticles adhere to a viscoelastic PMMA film above the glass transition temperature. The polymer was swollen with CO2, closely matching the conditions of nanoparticle-nucleated polymer foaming. It is found that the degree by which the particles sink into the viscoelastic substrate is strongly size dependent and can even lead to complete engulfment for particles of diameter below 12 nm. These findings are explained quantitatively by a thermodynamic analysis, combining elasticity, capillary adhesion, and line tension. We argue that line tension, here proposed for the first time in elastic media, is responsible for the nanoparticle engulfment.