And yet it happened.
There are (at least) three possible explanation.
1. The laws are still not strict enough.
2. The laws are good but the enforcement isn't.
3. The laws are OK, the enforcement is OK but you can't prevent all.
If 3. you'd have to look further and compare statistics. Laws and enforcement seems to work in other countries. They have much less shooting than the US. I don't know how states in the US compare. Does anybody?
One of the things often mentioned in this context is that, since the laws vary from state to state, there's very little prevent someone from one state going to another state to buy firearms. While it may be technically illegal, there is no system in place to monitor or control traffic from state to state.
I was doing a bit of checking yesterday, and found a couple of sites of interest:
Mass Shootings by State 2022 (worldpopulationreview.com)
The top 5 states ranked by number of mass shootings:
California
Illinois
Florida
Texas
New York
The bottom 5 states with the least mass shootings:
Wyoming
North Dakota
New Hampshire
Idaho
Hawaii
Looking at this other map, it shows the variations in gun laws from state to state:
4 out of the 5 top states for mass shootings have more restrictive laws than other states, whereas 4 of 5 of the bottom states with the fewest mass shootings have much more lax firearms laws.
It's not clear where the shooter in this case obtained his weapon, although Arizona is just a three hour drive away from where this occurred.
In the Buffalo case, the shooter purchased the weapon legally in New York State, but they suspect he could have gone to Pennsylvania for the magazine. From where he was living (Conklin NY), Pennsylvania is just 5 or 6 miles away.