I had the same problem (with Storekit 1 though. Not sure if that makes a difference). As long as you have your StoreKit file in your project it will always use this method. If you want to switch to Sandbox testing with the In App purchases (already set up in app store connect) from the app store just remove the StoreKit file from your project and also do not forget to remove it from Run configuration "Edit Scheme" where you added you Storekit before.
From now on you should be presented with the same modal but the title should say "Sandbox" instead of "Xcode".
Topic:
App & System Services
SubTopic:
StoreKit
Tags: