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.