I was today years old when I learnt that getting your ship impounded is a thing. I've respawned at a Prison Ship a few times, but I would certainly remember having to pay my ship's rebuy cost in order to be able to fly it again!
I'm still not completely clear on how ship impoundments actually happen. So it can happen if you get killed on-foot by lawful NPCs? That seems like a massive discrepancy compared to what happens if the cops blow you up in your ship. I'm pretty sure I've had that happen to me and not needed to pay millions to fly my own ship again.
You and your ship get blown up: Ship is no more - insurance means you can buy a replacement cheapily and because the ship is no more it no longer has any bounties from your misdeeds. You however are not dead, merely battered and bruised, so you have to pay your bounty off.
You get blown up, but your ship is ok: You however are not dead, merely battered and bruised, so you have to pay your bounty off - BUT if you have been committing crimes in your ship, the ship still existing means the ship still has active bounties. So your ship gets impounded.
In effect, getting a bounty while in your ship also puts a bounty on the ship.