In July 2020, Nintendo issued a new policy so that digital games are sold with a different procedure. That's why(?) download codes have been just as expensive as the games in the eShop ever since. Unfortunately I can't find a decent article about it anymore and even then the news was really sparse... So no guarantee.
Prices are set according to supply and demand, suppliers and availability of goods. For all these reasons, they vary very regularly and vary from one model to another (as with video games that are downloaded and those that are bought with a box).