Masks work on illnesses transmitted through droplets AKA spit coming out of people's mouths. They do not work on respiratory viruses that transmit via breath. If the mask stopped the breath everyone who put on a mask would instantly pass out.
Initially it was though covid was transmitted via droplets. Remember all the effort put into cleaning surfaces in case a droplet landed on it? Later it was shown this is not how it is transmitted.