>>23546442A type's resistances, weaknesses and immunities affect all pokemon of that type equally for the sake of balance and don't aknowledge specific cases where they don't make sense.
Ground type attacks often affect the ground (eartquake, magnitude, bulldoze, fissure, etc), so flying types can just fly to dodge those attacks, that's the reason why flying types are immune to ground
However, not all flying types can fly (eg: dodrio and hawlucha) and not all pokemon that can fly are flying types (eg: garchomp, mega charizard X). Also, not all ground type attacks hit the ground only, moves like bonemerang can be aimed at their opponent and should hit them even if they are flying
The anime aknowledges type resistances, weaknesses and immunities but only when they make sense