When Pfizer was testing their vaccines they monitored two groups of people - one group who got vaccinated and another group who didn't. What they observed was that 162 people got sick in the placebo group while only 8 got sick in the vaccine group. The conclusion was that the vaccine kept 154 people from getting sick. [
www.pfizer.com]
That's what they mean when they say the Pfizer vaccine is 95% effective: it keeps 95% of the vaccinated population from getting sick.
During testing they never checked to see who got covid in either group, just who got sick. For all they know just as many people in the vaccine group got covid as the placebo group. (Subsequent testing shows that the vaccines do lower your chances of getting covid by around 80%, but that wasn't the objective of the vaccines.)
The Moderna test results were similar: 94%
AlbaNY_Ram