I quickly checked in an emulator since I didn't know either.
SMB1 stores the score in BCD encoding, using 6 bytes, one for each digit - excluding the units, since score granularity does not go below multiples of 50.
If you have a score of 123,450, the bytes will be
00 01 02 03 04 05.
00 byte is reserved for properly handling millions. If you ever get scores between 1,000,000 and 9,999,950, there will simply be another digit displayed in front of the always visible 0's:
(The 6 bytes ahead of the marked ones are the TOP score, and the 6 following the Player 2 score.)
Technically, the maximum score possible is 9,999,990, 40 points above the maximum legal score which, as said, must be a multiple of 50.
If you exceed even this limit, the game will properly wrap over to 0, and the score is rendered as with a fresh game, with the millions-digit gone.
This is slightly spoiled by the
TOP- 000000 highscore display at the start screen, leaving a space for the millions.