Here is a list of all base stats--up to date as of S/V--excluding megas (because their stats don't really count as base stats), as well as unobtainable forms (because what would you do with that information), showing legendary and non-legendary Pokémon with the highest in each:
- HP:
- Non-Legendary: Blissey at 255
- Legendary: Zygarde (Complete Form) at 216
- Attack:
- Non-Legendary: Kartana at 181
- Legendary: Deoxys (Attack Form) at 180
- Defense:
- Non-Legendary: Shuckle at 230
- Legendary: Regirock at 200
- Sp. Attack:
- Non-Legendary: Xurkitree at 173
- Legendary: Tied between Kyogre (Primal) and Deoxys (Attack Form) at 180
- Sp. Defense:
- Non-Legendary: Shuckle at 230
- Legendary: Regice at 200
- Speed:
- Non-Legendary: Ninjask at 160
- Legendary: Regieleki at 200
- Total:
- Non-Legendary: Slaking at 670
- Legendary: Tied between Kyogre (Primal) and Groudon (Primal) at 770
Because I know that someone is going to say that the answer didn't specifically exclude megas of unobtainable Pokémon, here is a list including those, up to date as of Legends: Z-A:
- HP:
- Non-Legendary: Blissey at 255
- Legendary: Eternatus (Eternamax) at 255, followed my Zygarde (complete form) at 216
- Attack:
- Non-Legendary: Heracross (Mega) at 185
- Legendary: Mewtwo (Mega X) at 190
- Defense:
- Non-Legendary: Tied between Shuckle, Aggron (Mega), and Steelix (Mega) at 230
- Legendary: Eternatus (Eternamax) at 250 followed by Regirock at 200
- Sp. Attack:
- Non-Legendary: Tied betweem Alakazam (Mega) and Chandelure (Mega) at 175
- Legendary: Zygarde (Mega) at 216
- Sp. Defense:
- Non-Legendary: Shuckle at 230
- Legendary: Eternatus (Eternamax) at 250 followed by Regice at 200
- Speed:
- Non-Legendary: Ninjask at 160
- Legendary: Regieleki at 200
- Total:
- Non-Legendary: Tied between all the mega forms of Baxcalibur, Garchomp, Metagross, Salamence, Tyranitar, and Dragonite at 700
- Legendary: Eternatus (Eternamax) at 1125, followed by a tie between Mega Rayquaza and both forms of Mega Mewtwo at 780
Source 1: Pokédex with stats--Pokémon Database
Sourcce 2: List of all new megas in Legends: Z-A--Serebii (only for checking if any of the new megas had higher stats, as some of them aren't in my first source yet)
Hope I helped! And no, I did not just copy the entirety of the other answer that looks like this!