Receipt Verification - 21007 code with the sandbox endpoint

According to https://developer.apple.com/documentation/appstorereceipts/status the status code 21007 is returned, if a receipt send to the production environment comes from the test environment.
Therefore the recomended logic is as follows:
  1. send the receipt to the production endpoint

  2. if the response is a 21007 code, then send it to the sandbox endpoint

But what if the sandbox also returns with a 21007 code? That's happening for me and I don't know how to resolve this.
From the documentation side, this state is undefined.

Does anybody know
1) what does it mean to receive a 21007 code when sending a receipt to the sandbox endpoint
2) how to resolve this?

As you can imagine, following the above logic this results in a wonderful endless loop ;)

Thanks for any help!
Receipt Verification - 21007 code with the sandbox endpoint
 
 
Q