Who is responsible for paying a minor's medical bill if both parents are dead and no one has custody of him?

The state will take over the legal guardianship and pay the bill. He will end up in foster care.