Luna 16 was the first successful robotic probe to return sample from an extraterrestrial location to Earth for analysis. It did not return the first sample, that was done by Apollo 11, but it was the first time humanity successfully sent a robot into space to do such a task.
The illustration above and the text of the following were taken from multiple sources. I have identified them, but the narritive is not entirely clear on the process of how things went from Luna 16 landing, collecting a sample and returning to earth. But it illustrates roughly how it worked.
The ascent stage was a smaller cylinder with a rounded top. It carried
a cylindrical hermetically sealed soil sample container inside a
re-entry capsule. The spacecraft descent stage was equipped with a
television camera, radiation and temperature monitors,
telecommunications equipment, and an extendable arm with a drilling
rig for the collection of a lunar soil sample.
The article goes on to say:
The drill was deployed and penetrated to a depth of 35 cm before encountering hard rock or large fragments of rock. The column of regolith in the drill tube was then transferred to the soil sample container. After 26 hours and 25 minutes on the lunar surface, the ascent stage, with the hermetically sealed soil sample container, lifted off from the Moon carrying 101 grams of collected material at 07:43 UT on 21 September.
There appear to be two chambers involved - an initial processing cabinet (or vacuum tank) and a round examination cabinet. Samples were processed in an inert gas (N2?) to protect them from moisture, oxygen, and contamination.
NASA goes on to say:
The lower stage of Luna 16 remained on the lunar surface and continued transmission of lunar temperature and radiation data. The Luna 16 re-entry capsule returned directly to Earth without any mid-course corrections, made a ballistic entry into the Earth's atmosphere on 24 September and deployed parachutes. The capsule landed approximately 80 km SE of the city of Dzhezkazgan in Kazakhstan at 03:26 UT.
Luna 16 lunar sample: