I don't know how every single lottery works, but jackpot games generally have completely separate prize pools for the different levels of prizes. Those prize pools are funded with fixed amounts from every ticket that's sold, and the amounts are related to the probability of winning each prize so that over the long term the amount paid into the pool is fairly close to the amount won. As long as prizes are won on separate tickets (or separate plays on a ticket with multiple plays) the prizes are independent of one another.
In theory you could play the same 5 numbers with every single mega number and win the jackpot and 24 5+0 prizes. You'd get your full share of the jackpot, with no reduction based on all of the 5+0 prizes. If there are an unusually large number of winners there's a chance that lower prizes could become parimutuel, and each individual 5+0 prize might be worth less than $1 million., but that would still be completely independent of the jackpot winning ticket.