Traveller has long had some thoughts on Inward Clearances (the inspections your cargo undergoes).
In higher tech systems, when you arrive, if they have a middling or higher law level, you probably have to file an in-system flight plan. If this seems to take you to an inhabited planet that has enough control of its own affairs to be able to have customs laws, either you'd be met in orbit (if their was a highport) or at the downport to be inspected. The locals would care because you were planning to land and thus enter their jurisdiction. The Imperium may well inspect your vehicle as well when you land at any port it administers (high or down). Worlds often have other ports, as pointed out by another poster, that likely are not administered by the Imperium (or your setting may not have an Imperium or any outside authority with extraterritorial areas).
When the locals inspect your cargo, they could seal some of it up, force you to put it in bond houses until you leave, charge you fines, charge you duties if it is legal, charge you tarrifs if those apply, charge you service fees, detain you, beat you, and/or have you lined up for execution. A lot depends on the cargo and the authority and their local religion, culture, ethos, level of xenophobia, etc.
Now, the thing that keeps such a messy situation from totally being a disaster is usually the fact that word gets around if any polity is executing traders and then they get less trade (perhaps none). That could be their goal or that could be a bad side effect. Once a polity becomes a pariah and cut-off from cheaper, better goods from elsewhere, it won't fare as well in most cases. So locals might not want to court such an outcome.
So spacer crews are likely mostly fined and sometimes have cargo confiscated. Maybe a short stay in jail to remind them who is the authority. Much of the time, it would be duties and maybe service costs of the inspection, for most cargo. Plus paperwork.
Of course, bribery, forgery, persuasion and other skills could help you navigate the local bureaucracy (even to the point of ignoring the laws because you bribed the right officials).
So, what customs inspections you have, when, and by whom, and what they result in, has everything to do with:
Setting (3rd Imperium or other)
Presence of outside authority or not
Corruptability of local officials (higher law >> higher corruption almost inevitably)
Crew legal, admin, etc. skills (or diplomacy, or persuasion or all sorts of other options)
Whether you have a balkanized planet
Whether the local polities can control their own airspace
Whether you can sneak in
Whether you are going to a spaceport, a starport (main downport or high port), or just landing
Local culture, ethos, beliefs, religion
And a horde of other factors.
One of the fun parts of the balkanized tech/culture situation in the 3rd imperium especially around the borders is it makes for great variance system-to-system which makes trading expeditions so much fun. Sci fi has used this sort of setting to keep Merchant protagonists (esp Free Traders) on their feet and you can do so too as a GM. Every new world is a new bundle of risk, opportunity, and new rules and local people to interact with.