You're right -- Potter is much bigger than Nintendo/Mario.
If you look at pure revenue it seems like Mario is bigger, but that's not the correct way to measure it. Mario has had dozens of video game releases (along with other things, but the vast majority of revenue is from the video games) over 30+ years. They're also not all unique sales, so aggregating them into one whole gives you a very misleading number.
Most individual Mario titles (basically eliminating ones that came packaged with a system) sell around 10 million copies (which is great!). That doesn't tell you everyone who played them, because some people rent them, buy used, borrow from a friend, etc. -- so let's be exceedingly generous and double it to 20 million. As mentioned above, those aren't 100% unique sales, so you can't just aggregate them across all titles. Some percentage (and likely a relatively large percentage) of sales are to the same individual people; i.e. the same person has bought the 5 most recent Mario games, so those 5 sales only account for one customer. That doesn't matter to Nintendo because they're all sales, but it absolutely does matter for something like theme park attendance.
The first HP book has sold over 120 million copies. There are, of course, some repeat sales in that number, but there's no way to finesse the numbers to get that and Mario even close to one another in terms of cultural reach. The movies also sold something like 100+ million tickets each, and not everyone who saw the movies also read the books -- there's plenty of overlap in those numbers but it's certainly not 1 to 1; there are plenty of people who only ever saw the films.
None of that is to say Mario isn't a valuable property, because it absolutely is. But it's not on the same level as Harry Potter.