The episode itself did not credit Robert Louis Stevenson (although this website does) and, to be fair, Stevenson adapted the story from previous works (it's a German folk tale, I think).  Stevenson set his story in the Kingdom of Hawaii before the USA acquired it as a territory.

All the versions--the Stevenson version, this version, and Stevenson's source material--deal with the problem of how to sell the imp when you have bought it with the lowest monetary coinage.

The ending is different from Stevenson's ending, but it's a very fine modern adaptation.  Deal with the Devil.