Flying Pokémon are immune to Ground type attacks in the games, but not in the anime. This is demonstrated in the episode titled "Playing with Fire", where a trainer's Steelix was able to use a dig attack on Ash's Noctowl. Despite Brock's mom's Mantine being a Flying Type, Brock's Onix was able to nail Mantine with its Dig attack, draining the water in the gym in the process.