It doesn't, actually. The official description from the IEC says:
Ingress of water in quantities causing harmful effects shall not be possible when the enclosure is continuously immersed in water under conditions which shall be agreed between manufacturer and user but which are more sever than for numeral 7.
Emphasis mine. The standard test for IPX7 is submersion in still water to a depth of 1 meter for 30 minutes. IPX8 is "better than that". Apple, Google, Samsung, etc. all define how much better on their own. CNBC has an excellent video explainer on what exactly all this means.
These companies are designing to protect against people dropping their phone in the toilet, or maybe a kiddie pool. And yeah, as called out in the CNBC video, the advertising is very deceptive and unfair.