Coffee bags often have valves that allow gas to escape, as recently roasted beans are still “degassing”. When you went up to high altitude, the air pressure inside the cabin dropped, leaving the inside of the bag at a higher pressure. This high pressure caused air to be pushed out through the valve. And since the valve is (approximately) one-way, the reverse didn’t happen when you returned to lower altitude. Even though the air pressure outside was now higher than inside the bag, air could not (easily) enter the bag through the valve.
These aren’t super high-quality valves so if you left it for a while I bet that the bag would slowly refill with air until the pressure was equalized again. But they’re probably good enough that it takes a while, and so for some time after landing the bag would have stayed in this “shrunken” state.
Latest Answers