Metal cans, glass bottles and aluminum foil lidding are hard, smooth and completely non-porous. There's nothing for the ink to soak into, so the code has to bond to the surface itself. Water-based ink beads and wipes off. And these parts are often curved, and can carry a film of oil, dust or condensation from upstream, all of which fight adhesion.
Get the ink and the surface right, and thermal inkjet codes metal and glass cleanly at high resolution: dates, lot codes and barcodes, from sealed cartridges with no make-up fluid and almost no scheduled maintenance.