If this was a free app unlocked with an in-app purchase or a subscription and you use the same account on the other device, it should be possible to restore the purchase. You can try going to the Parents section in the app (or Settings) and tapping on the Restore button.  The Restore button can also be found on the main screen in some of our newer apps.

This also works if the app was for some reasons locked again on the same device (after reinstallation, update etc.).

Unfortunately, the App Store does not support in-app purchases or subscriptions on family sharing (for all apps). See more here: https://support.apple.com/en-us/HT203046