In the English system someone being held by the police is 'in custody', when they have been charged and are detained waiting for trial they are 'on remand' and when they have been convicted they are 'in prison' or 'in gaol'. 'Jail' is the American spelling of the English word but both are pronounced the same way.
Why not imagine that it indicates the sister works in the prison, without explicit meaning about actually working for the prison or not? I'm sure most listeners would assume she works for the prison, but that doesn't mean the words actually contain that meaning. Maybe the sister is a prisoner who does some kind of work in the prison, but the speaker doesn't consider it working for the prison. Alternatively, maybe the sister is a prison guard who does work for the prison, but also happens to actually work in the prison; she used to work outside, guarding the driveway gate that leads to the prison, but her new job is in the prison. Her brother actually works for the prison also, but he is their accountant who works in the office across the street.
I guess I wasn't very clear in my question: does på ett fängelse use på because the noun is indefinite, while i hamnen uses i because the noun is definite, or does på ett fängelse use på because fängelse as a noun just happens to prefer it, or does på ett fängelse use på for no other reason than "just 'cuz"?
In English, you "work on a farm" but you "work in a prison". In this case, I think the difference is that farms are outdoors. We also say "work on the army base", but we "work in the city". What's the explanation? I think languages often remember things that we don't. The way some preserve noun genders also doesn't seem to make much sense. Maybe some early prisons were actually quarries and one "worked on" the quarry because it just felt right to say you were working on the stone more than it felt like you were indoors; much of the quarry experience may have been outside, hammering a cliff face rather than in the quarry caves you were kept in at night. I'm making this up, but my point is that the word may remember something that we don't.
I appreciate the Swedish distinction. I didn't know that.
In the American system, there is a further distinction in 'jail'. Someone is arrested and (usually) held in the jail for some period of time (or, for a short time in a 'holding cell' as seen in TV shows, sometimes a 'drunk tank' --slang).
After they are sentenced, they could serve time in either a jail or a prison: "He was sentenced to thirty days in the county jail" or "He was given five to ten years in prison."
It's not my field but I believe that 'jail time' is for lesser offences (say drunk driving as one example) and 'prison time' is for more serious felony convictions.