Yes. EDIT: Wait, are you asking if the character of Maverick is really flying a (movie) F-18, or are you asking of the actor Tom Cruise is really flying a real F-18 and that footage is in the movie?
I think he's in a two-seat variant of the F18 with a little dressing up to make the second seat look like the pilot's. He's syncing his motions to the pilot's, who is giving him cues through the headset. Or it's a really good visual effect.
We used to have a staff artist (Dick Kramer) who painted Air Force jets for a living. He'd get rides in F-15s and take his own air-to-air reference shots. I occasionally begged him to take me along, but obviously the paperwork and training and such was out of the question. But he told me his biggest secret of how to be a good air-to-air photographer in a military jet while maneuvering - shove as many airsick bags as you can into every pocket, strap and harness on your suit.