Is it possible to trade up during ones PhD in Mathematics?

Yes, it is a feasible plan. But it's not straightforward.

Things to keep in mind:

  • the PhD advisor in the first school might have different expectations. One might consider being open about the plan to get only a Masters's degree. Otherwise, it is both unfair to the advisor and can lead to many issues.
  • to get to a different PhD program, one will need good letters of recommendation. Thus, the relationships with your original PhD advisor are important.
  • expected prolonged graduation times: residency requirements, different courses schedule, and in general B.Sc. + Ph.D. usually (!) are faster than B.Sc.+M.Sc.+Ph.D, especially when different levels are completed in different educational institutions.
  • you might get better or worse financially but getting qualified or disqualified for some scholarships. This is strongly dependent on the individual factors and exact policies of educational institutions.
  • change (drastic/slight) of the research topic, which can be also a good thing or bad depending on the individual factors.
  • in case the PhD application to a new program fails, one might have already burned some bridges, and certainly did not help themselves in the pursuit of a PhD.

This is mostly advice, but to make it a formal answer, yes, it may be possible to do this, though it may not be desirable. It may add to the time required for your degree and, the switch has a nonzero chance of putting you into a difficult situation that you could have avoided. Not everyone succeeds at any given institution. There are many stories on this site about top level advisors abusing students, sometimes just by ignoring them in favor of their own research.

But, for the advice:

I suggest you take the offer you get that seems best to you. But rather than looking at the ranking of the institution, look at the faculty there who have proven interests in what you see as your chief likely research trajectory. More than one such faculty member would be advantageous for a few reasons. One is that they may have a small research seminar with those faculty and a few students. The other is that when you need an advisor, you are more likely to find a good one. Not everyone accepts students every year.

The second part is to constantly evaluate your experience at that institution and only leave if you become dissatisfied in some important way. There are reasons for being dissatisfied: not enough challenge, abuse, other opportunities that seem better.

Do what you can while you are at that institution to work as closely as possible with those faculty that have similar interests. Don't be invisible. Ask a lot of questions. Do good work. And figure out who would be the best advisor for you there and work to get accepted by them.

And note that relationships established in grad school can last a lifetime.

Then think about whether it is worth "trading up" given that you will be leaving relationships behind and still have to meet all requirements at the new place, but starting as a "newcomer" unknown to the faculty.

My personal view, but maybe not yours, is I would only desire to move if I found myself insufficiently challenged. But my experience was that having the right advisor was the most important single thing in my success.