Hi,
Please check your Microsoft Store and Xbox to confirm that the same email address used for the purchase is logged in. The account should match on both apps.
If it is the same, try logging out of your account on both apps, then close them completely. Make sure they are also removed from the running background apps. Reopen the apps, log back into your account, and try installing the game again.
If that does not work, try installing the Minecraft Launcher either through Xbox or from the official Minecraft website.
If the purchase was made through Xbox, I recommend requesting support from Xbox.
If you require additional assistance, please let me know.
Stay Safe!