For landing a research position right after graduation prestige of the school matters a lot. At this point you haven't really had a chance to make a name for yourself (unless you're exceptionally outstanding). If people already know other good students from your school, or in other words are aware that your institution produces quality students, then it's easier to find a position than if you're a really good student at a university that no one has heard of. Hiring a good student from a well known institution is simply lower risk than hiring a good student from an obscure university.
At the end of the day, however, the most important factor for landing a tenure track position is probably the measurable quality of your work, I.e. number of citations and prestige of journals published in.
Still, there's a high correlation between the prestige of universities where people got their PhD and the prestige where people end up as tenure track, if they do so at all. Most people who manage to get tenure track positions at research universities have PhDs from very prestigious universities. There are several reasons for this.
1. People with high potential as mathematicians tend to perform well as undergraduates, and get into prestigious graduate schools.
2. As mentioned above, those with PhDs from prestigious schools have an easier time landing good positions early in their career, while those from lower ranked schools are more likely to leave academia because they can't get a research position.
3. Those who attend more prestigious schools simply get a better education. Statistically, they will interact with better mathematicians who will have higher expectations of them, their peers will be more advanced, and they will be in a place where mathematicians from other schools come to present their newest and best results. Better education produces better mathematicians.
If you do your PhD at a lowly ranked school, it's not impossible to land a tenure track position, but it's going to be harder than if you do your PhD at a prestigious school, because the deck is stacked against you. Already, it's very hard for students even at well known universities
to land tenure track positions at any research university, even more so at group 1 universities. So it's going to be extremely difficult, and I would not count on it. But of course it is not impossible - just let your work speak for itself.