The 12th Amendment seeks to prevent this, but its language may be insufficient (it was passed before term limits were set in the 22nd Amendment). From Wikipedia:
There is a point of contention regarding the interpretation of the >Twenty-second Amendment as it relates to the Twelfth >Amendment, ratified in 1804, which provides that "no person >constitutionally ineligible to the office of President shall be eligible >to that of Vice President of the United States."
While it is clear that under the Twelfth Amendment the original >constitutional qualifications of age, citizenship, and residency >apply to both the President and Vice President, it is unclear >whether a two-term president could later serve as Vice President. >Some argue that the Twenty-second Amendment and Twelfth >Amendment bar any two-term president from later serving as >Vice President as well as from succeeding to the presidency from >any point in the United States presidential line of succession. >Others contend that the Twelfth Amendment concerns >qualification for service, while the Twenty-second Amendment >concerns qualifications for election, and thus a former two-term >president is still eligible to serve as vice president. The practical >applicability of this distinction has not been tested, as no former >president has ever sought the vice presidency. During Hillary >Clinton's 2016 candidacy, she said that she had considered >naming Bill Clinton as her Vice President, but had been advised it >would be unconstitutional.
The constitution does not restrict the number of terms a person can serve as Vice President.