Do math departments require the math GRE primarily to weed out applicants? Or is it predictive of completing the program?
This answer applies to the US, and maybe not universally even there.
Graduate admissions in the US are broad based with many factors to consider. GRE may be one of them but less so since the onset of COVID. In particular, letters of recommendation have high value.
The GRE, by itself, is a poor predictor of success in mathematical research. It shows that a person with a good score has some background knowledge that is fairly broad based and is a good problem solver in those areas that they have studied. But that isn't the same thing as actual research in mathematics: the ability to extend the field into the unknown. Other mathematicians who have worked with a person are a better predictor for that.
It isn't an either/or in this case. It can be both/neither, actually, or even an orthogonal.
Doctoral admissions committees often get a lot (a lot!) of applications. The problem is to have an idea where to spend the effort needed to select good candidates. In some (many?) places a first effort might be made to separate applications into two piles, with only one being focused on. That separation might use GRE or GPA or a combination, since it is quick and easy. Time is spent on the applications that get through that first gate. If a class can be built on the higher scoring applicants there is no need to go back to the other pile. If not, the range might be extended somewhat.
However, many places will spend some effort in looking within that secondary pile for people whose letters are outstanding and the writers trusted. So, a poor GRE might still not be exclusionary even in a place that uses them. Nothing can be guaranteed here. Rules might even require that someone go through each application and, perhaps, assign it a score to guide further action.
But doctoral study is about research, not about retaining lots of information or about problem solving. At best, the GRE shows that a candidate has the necessary background and skills to begin the journey, rather than a predictor of success in achieving the goals.
Personal note: I took the exams more than 50 years ago and don't remember my scores. They were pretty good, I think, and I was a pretty good "test taker" at the time.
What I do remember, however, is being extremely depressed on completing the advanced exam since there were many questions for which I'd never even heard the terminology used. In the US, undergraduate programs differ quite a lot in the upper level courses, so the test has to be very broad so as not to disadvantage people because their curriculum wasn't "typical". I remember the scores being surprisingly good after my initial disappointment.
Supplementing @Buffy's good answer:
In the last 10 years or so, and especially stimulated by the (im)practicalities of Covid, many math depts have found incentive to stop believing that math subject test GRE scores are useful at all. Yes, as has always been the case, the "most elite" places can use scores as a filter, because they'll still have lots of candidates who pass a (somewhat, but not entirely) meaningless filter.
In my R1 U.S. univ, for a few years now (even before Covid), we'd stopped looking at (or requiring) GRE subject tests... or any other GRE tests, for many reasons.
Quasi-ironically, already many years ago, our grad admissions people realized that we could not compete for potential students with the absolute highest numbers (whatever that might mean). Thus, as in pretending to make subtle intelligent choices in investing in under-valued stocks in the stock market, we deliberately chose to look at students who had "bad numbers", but who had stellar letters of recommendation, etc. One extreme case was a person who was in the bottom 6th percentile on the GRE, but finished her Written Prelims and Oral Prelims and thesis on a faster track than her "peers".
Returning to the specific original question: it is slightly misguided, in the sense that grad programs cannot pretend to only admit "the very best" students, because (by whatever standards) those students will have other offers. Yes, it's difficult to sort out the huge pool of applicants... and, yes, at the same time, it is a logistical failure to make many grad admission (and funding) offers that are rejected.