
In the meantime I got even more confused while digging deeper into this issue. It's not just we struggle with the links, it also depends whether one uses classic view or modern experience. Here is part of my findings:
https://spnt.mobilexag.de/mx/sales/Prospects_Customers/DTo_Test/A_202007-06a.docx --> instantly downloads the document locally
https://spnt.mobilexag.de/mx/sales/_layouts/15/guestaccess.aspx?guestaccesstoken=5%2bfkNGtON9SivuGLPidvTPpICFXEeGCY%2b5fShDhWqA0%3d&docid=2_15ffd4d04722946768c1eb7a06de83c37&rev=1 --> opens the doc in Office Online on-prem server
https://mobilexag.sharepoint.com/:w:/r/marketing/Freigegebene%20Dokumente/A_Komplettangebot.docx?d=w0282065f4f1e4302a155cac0d71364f6&csf=1&web=1&e=SCHKTK --> Opens the doc in the Office Online App
All I can say is that SharePoint Online links open for me in the Office App in browser, they do not get downloaded unless I strip down the link looking the same way as the plain on-prem one does, like e.g. from https://mobilexag.sharepoint.com/:w:/r/marketing/Freigegebene%20Dokumente/A_Komplettangebot.docx?d=w0282065f4f1e4302a155cac0d71364f6&csf=1&web=1&e=SCHKTK to https://mobilexag.sharepoint.com/:w:/r/marketing/Freigegebene%20Dokumente/A_Komplettangebot.docx. In that case behavior is the same and the document just downloads
Here I found a few threads dealing with how links are created in SharePoint, online and on prem and so on and so forth...:
https://learn.microsoft.com/en-us/answers/questions/545738/creating-link-to-document-in-sp2019-on-premise.html
https://cresyl.eu/en/sharepoint/understanding-how-share-links-are-built/
https://learn.microsoft.com/en-us/answers/questions/158334/why-does-sharepoint-2016-copy-option-only-show-bas.html
Maybe this helps clarifying my problem.
kind regards,
Dieter