A contemporary synopsis of the novel's plot describes it as follows:
This is the story of a young Irish boy named Sandy Kilday, who at the age of sixteen, being without home or relatives, decides to try his luck in the new country across the sea. Accordingly, he slips aboard one of the big ocean liners as a stowaway, but is discovered before the voyage is half over and in spite of his entreaties is told he must be returned by the next steamer. Sandy, however, who has a winning way and sunny smile, arouses the interest of the ship's doctor, who pays his passage and gives him some money with which to start his new life. On the voyage Sandy has made friends with a lad in steerage named Ricks Wilson, who earns his living by peddling, and he decides to join him in this career. Sandy has also been deeply impressed by the face of a lovely young girl who is one of the cabin passengers and when he discovers that she is Miss Ruth Nelson of Kentucky he decides to make that state his destination. He and Ricks remain companions for sometime although Sandy's strong sense of honor causes disagreements as to the methods of their dealings. Sandy finally becomes disgusted with this life and after catching a glimpse of Ruth at a circus, where he is dispensing his wares in a humorous manner, he decides to abandon it altogether.
He parts from Ricks and falling ill by the roadside is picked up by a colored woman named Aunt Melvy, who is in the employ of Judge Hollis. The latter takes Sandy to his home and his wife nurses him through a long fever and then, as they are childless, they adopt him into their household. The Judge gives Sandy a good education, sends him to college and he becomes a successful lawyer. All this time his love for Ruth has been unswerving though she has not responded to his advances. Judge Hollis is shot by an unknown assailant and Sandy, who discovers the assailant to be Ruth's dissipated brother Carter, refuses to give evidence against him. Sandy is kept in jail until freed by Ruth's intervention, Carter having confessed his crime to his sister before his death. The Judge recovers from his wound and Sandy and Ruth are happily married to the satisfaction of all concerned.

Question: Who ends up paying for Sandy's passage on the ocean liner?
Answer: The doctor.
Alternative answer: the ship's doctor