Frank Hardy has discovered girls, annoying younger brother Joe, who is bored and longing for another mystery to solve. While Frank chats endlessly on the phone, Joe is forced by Aunt Gertrude to accompany the perpetually hopeful Iola Morton to a dairy farm just outside Bayport. After retrieving some goat's milk needed for her baby sister, Iola and Joe have an accident, spilling the milk and wrecking Joe's bicycle. Joe spots a nearby farm with a goat, but when he and Iola go there, they discover the place is abandoned, though it still shelters several animals. Joe suspects someone is around, but hiding. Frightened, Iola rides off, only to encounter insurance man Mr. Binks, who warns her away from the farm.
Summoned by Iola, Frank Hardy rides out to the farm. He is accosted by a farmer named Sam, who also warns him away from "that spooky old farm", formerly owned by Old Lacey, dead for a month now. Frank enters the farmhouse, and hears a noise he thinks must be Joe. Going upstairs to locate him, Frank is surprised to hear Joe downstairs. The boys panic and race outside. While they try to collect themselves, a young man drives up and hails them. Eric Pierson claims to be the nephew and heir of old Lacey, who recently died in a forest fire. Lacey had inherited the farm himself, from his brother Billy, but couldn't pay the property taxes. After hearing the boys' story, Eric searches the house but finds nothing. He offers to drive the boys home, but when the bikes are put into the trunk, Joe's has been mysteriously repaired. Eric hires the Hardy Boys to "investigate" the mystery.
Returning later, the boys set a trap for the mysterious person hiding at the farm, only to have the trap sprung on them. The mystery fellow turns out to be a frail elderly gent, who nevertheless is spry enough to hang from window ledges and climb around the roof. He tells them to just call him a ghost, and explains he was a friend of Lacey and old Uncle Billy. He's now taking care of the animals, but doesn't want anyone to know about him. Eric again drives up, having seen a light at the farm. The "Ghost" vanishes, and the boys don't tell Eric about him. After Eric leaves, the Ghost reappears, and hands Lacey's will to the boys. He explains that Lacey's life insurance money should pay for the upkeep of the farm animals, as directed by the will.
The boys give the will to their father and Mr. Binks, who submits it to the court for validation. Joe realizes that the will was written in purple ink, the same as was in a fountain pen he lost at the farmhouse. Going back to the farm, the boys corner the Ghost and accuse him of writing the will. But when they phone Mr Binks to alert him, they learn the handwriting on the will really was Lacey's. The Ghost confesses he is Lacey, that he allowed people to think he was dead, so his insurance could take care of the animals.
The boys learn from zookeeper Mr. Bray that a court order was to have the farm animals hauled away by a man named Fred. The finding of the will was supposed to have stopped that, but someone told Fred to take the animals anyway. When the animals break out of the truck and scatter through Bayport, the boys and Eric try to recover them. At the zoo, they try to catch the billy goat, only to find the zoo's lion has escaped. The lion corners Eric, while Frank forces him to confess that he told Fred to take the animals. Mr. Bray appears and reveals the lion is harmless, a fact already known to Frank. The boys find a key hidden in the billy goat's bell that opens a safe deposit box containing Liberty Bonds left by Uncle Billy. They now belong to Lacey, who uses them to save the farm animals.