There have been a number of
laboratory studies performed that show varying levels of effectiveness for different kinds of masks and materials (where "effectiveness" is defined in all sorts of different ways that may or may not be relevant). Prior to Covid-19, there was a low-quality evidence base that didn't provide much signal either way:
https://www.cebm.net/covid-19/masking-lack-of-evidence-with-...
Strapping a mask on a mannequin or to a nozzle is, of course, very different than asking people to wear them everywhere. For evidence of real-world effectiveness of a medical intervention, you do a controlled trial. We could have done some, but we did not. It is notable -- but not at all perfect -- that the only RCT conducted with masks and Covid-19 in 2020 found no significant personal protective effect:
https://www.acpjournals.org/doi/10.7326/M20-6817
It is a well-done study, and certainly limits the claims that can be made for masks, but doesn't answer every question. A good cluster RCT might have been able to address the question of whether or not masks protect others, for example.