My friend and I have had similar experiences. First time it happened to just me; i landed on mercury to check out a crashed ship-- got out of my ship and walked 100m to suddenly see bounties stacking up on my head with no warning whatsoever. I immediately turn around, get back in my ship, and dock at Daedalus to pay the fine. Well it turns out i had to "hand myself in" over a 400c bounty. Ok, not a big deal. I appear on some prison ship somewhere, go to get back in my ship and suddenly its saying i have to pay a 39 million credit rebuy for my anaconda. Like what? good thing i was sitting on a pile of many millions... or i'd have lost my engineered anaconda for no foreseeable reason.
The second time by buddy joined me for bounty hunting in Barnard's star. we finish a couple wing missions, go to the turn-in settlement, and realize the turn in location only has one pad. They land near the settlement, get out of their ship, and for some reason takes out their weapon. Within ten seconds they are dead because the security forces decided taking out a gun is immediately punishable by death-- and they couldn't figure out how to put it away or even turn their shields on in time because they were on fresh keybinds. We both had to rebuy our ships, my 39m rebuy anaconda and their 1.2 billion cost cutter... I don't really see this as their mistake; security should only become hostile if the player initiates combat first or otherwise has really bad reputation. We also really need a warning if we're about to enter a trespass zone in any mode of play.
I have not been able to convince my friend to try ED again since the second incidence.
(IRL security requires intent, capability, and threat of immediate bodily harm or threat to life sustaining infrastructure to react with force. Simply taking out a gun does not fulfill all of these.)