This is all a game of probabilities. The vaccine doesn't "prevent" infection the sense of making it impossible, what it does is reduce the probability of infection, as well as the seriousness of the symptoms and amount of viral shedding. So, a vaccinated person is 1) less likely to get infected, 2) less likely to fall ill if infected, and 3) less likely to pass it to someone else if infected.
Note, "less likely". Vaccinated people can still get infected and get sick and infect others. But if you're working for the public health authority and you want to minimize harm caused by the virus, then you're in the business of reducing probabilities of infection and illness and transmission.
(Ditto for masks, and for all the other vaccines we get that very few people complain about, and for making everyone get out of the swimming pool if there's shit it in, and for not re-using intravenous needles, and for laws prohibiting drunk driving, etc. We not *preventing* bad things from happening, we're simply making them less likely)