"Prep" for me is all the time you spend outside of the game getting ready for the game. As an incomplete list it includes:
a) Brainstorming
b) Generating NPCs and recording their opinions and thoughts.
c) Drawing maps.
d) Producing props and images.
e) Detailing encounter locations and populating them with monsters, treasure, traps, and hazards.
f) Recording backstory and backgrounds for NPCs.
g) Figure out the clues and breadcrumbs that the PCs might find that allow them to find and interrupt the nefarious activities of NPC villains.
h) Reading and researching information online or at a library in order to enrich your setting.
i) Detailing setting at a high level through world building of religion, history, geography, politics, art, etc.
j) Reading published game or story material in order to either familiarize yourself with it or to incorporate lore from a preexisting setting.
k) Generating or collecting random tables in order to provide idea fodder for down time or unexpected events.
l) Writing, amending, or clarifying rules and rule sets in order to achieve some desired goal.
m) Amending or extending published adventures to get stronger story beats, fill in plot holes, and create paths if the players go in directions that the original author didn't anticipate, or to adapt the story to your particular PC's or setting.
n) Creating custom programs to autogenerate material that would be expensive to create by hand, such as random loot tables, random NPCs, etc. Or else learning how to utilize custom programs that others have created for that purpose.
In general, "Prep" in my experience takes 1-5 hours for each hour of intended play depending on the system, your ambitions in storytelling, how experienced you are with the system, and the level of professionalism you like in your notes (that is, how clear would they be if you gave them to someone else). Anyone that is spending less than that, probably isn't thinking about all their prep (running one shots in rules light systems still requires you to thoroughly familiarize yourself with the rules and setting) or else probably isn't running a very ambitious game.
As for running without prep, that either fails completely or else at some level you are using someone else's prep or your prior prep to get ready. For example, many extemporaneous GMs have scenarios that they have run many times in the past for different groups and so can run those scenarios with slight variation quite easily, they way that a public speaker can give a speech on short notice by relying on their existing material.
As for "running a game on the fly", all games are run on the fly because no amount of prep can ever fully prepare you for what players with real agency are going to do. You will always at some point be handling unexpected situations that aren't covered by the rules, or aren't covered by your notes. However, good prep prepares you to handle those situations well, so that you can easily extrapolate from your notes what might happen, or else be so familiar with the rules of the system that you can readily adapt some portion of it to the problem. A lot of prep time is actually created by recovering from the story going in unexpected directions or players proposing to do some perfectly reasonable thing that you have no rules for at all and now need a long term solution that is fair, balanced, and interesting.