He used it even earlier in the story The Crystal Egg from 1897. It's a convenient literary trick/trope to use when you want to give the protagonist a leg up/get the story moving without being too obvious about it.The oldest example I know of is H.G. Wells' The Magic Shop, in 1903, but I wouldn't be surprised if there are older ones.
I guess this belongs to the trope "The Little Shop That Wasn't There Yesterday", were a shop/shopkeeper pops up out of nowhere to provide the protagonist with exactly what they need and then the shop/shopkeeper disappears. This trope is similar to the MacGuffin trope, but the latter can be almost anything between randomly finding an object to bumping into a person.