That code is either cut & pasted, or custom-URL-handler'ed, over to the new install, unlocking the same features as an in-app-purchase. (Or maybe there's a bounce through Safari, somehow leveraging its offer-to-launch-or-install functionality to minimize the steps, or through the vendor's own servers keyed by opt-in email address. Lots of possibilities, really.)
With this pseudo-upgrade process, even as convoluted as it is, it all remains inside Apple's system.
I suppose the key question is: does Apple allow promotions that give some people the same effect as in-app purchases, while others still have to make the paid purchase? (I think they do.) I could see Apple objecting if the feature-turn-on is in any way a reward for outside-of-App-Store valuable behavior - that's circumventing Apple's role.
But if it's an extra bonus for an earlier in-App-Store action – the N-1 version purchase – Apple's role hasn't been circumvented. In a way, it's been reinforced. So the same logic driving the prior veto wouldn't apply.
(1) offer a reduced-functionality "version N" to everyone, but for the desired 'upgrade' price. (Essentially, this might only have the features of the prior N-1 version.)
(2) offer an in-app purchase unlocking full/pro features, priced at the delta between their desired "full Version N price" and what was already paid
(3) give owners of the previous "N-1 Version" a code that gives them the in-app purchase benefits for free
Maybe Apple would still object... but since the entire process happens inside Apple's system, paying Apple's commissions, advancing the use of Apple's in-app purchase mechanisms, maybe they'd be OK with it.