The root of the problem is the assumption that everyone will try to avoid the bad outcome at all costs. As Stevenson shows in the original story, that's not necessarily the case.

One possibility is that the buyer considers his own salvation less important than the things he can wish for. A pragmatist (or a Vulcan) could buy the bottle for an arbitrarily low price, wish for world peace, and call it a day. Even if he gets stuck with the thing, this is a positive outcome in his belief system.

Another outcome is that the buyer is doomed to suffer the penalty anyway, and so has no reason to eschew the deal. In the original story, the bottle ends up with an old sailor, who has lived an unvirtuous life. He reasons that his life has damned him to hell already, so he might as well pay one centime for the imp, and at least make the rest of his life comfortable.