Money is a fungible thing. There is no way to distinguish between "this" dollar and "that" dollar; a dollar is an ephemeral representation of purchasing power.
If I had a dollar in my pocket, and I stole a dollar from fistful, and I (with two crisp dollar bills in paw) went into the Kwik-e-Mart and handed the clerk the dollar that was mine at the beginning, saying, "Here, sir, is a dollar, with which I should like to purchase one of your fine apples." And then, in a separate transaction immediately thereafter, I use the illicit dollar to purchase a winning lottery ticket, why, then, how is that different from the exact situation, except for that the specific dollar I used for each transaction is swapped?
In the one case, some of you would hold that I owe fistful my lottery winnings, because I used the dollar I stole from him to buy the ticket. But what about the second situation? I owe fistful an apple, but get to keep my winnings? How about if I spend both dollars at once, purchasing an apple and a lottery ticket. Which portion is owed to whom? Do I owe fistful half an apple and half my winnings? Do I owe the store anything?
In all three cases, the store has lost nothing; it received two dollar notes for two tangible items valued at a dollar each. My transaction with them is complete, and I owe them nothing.
I have taken a dollar from fistful, illegally, however, and he is entitled to his dollar back (plus overhead, as Len mentions). That is his recourse. Then, as I have broken the law, the state may prosecute me for the magnitude of my crime: that is, the theft of a dollar.
Suppose that I had $99 in my pocket, and I stole fistful's dollar. Then I bought a lottery ticket for a dollar. Who can say whose dollar the lottery commission received? Did it receive mine? Or fistful's? Or did it receive 99 cents from me and one cent from fistful?
Suppose the dollar was borrowed, and not stolen? In this case, there is the obligation of repayment of the loan itself (plus interest if applicable), not of the windfall value that was acquired using that dollar. If I borrow a dollar from fistful, and buy a winning ticket with it, do I owe him the winnings, because it was "his" dollar I used? No. Because I only have obligation to repay him the amount I initially obligated myself to him for.
While theft causes one person's resources to be taken away without their permission, and this creates an intrinsic obligation of repayment, this obligation is, like a loan, for the value of what was taken (plus interest and administrivia, of course), not for the value of the windfall that resulted after the fact.
Whether I get to keep my winnings is something else. But they're absolutely not owed to the victim of the theft. And they're not legitimately the property of the lottery commission, either; they contracted one chance at winning the prize, in return for one dollar. They received the dollar, they gave turned over the chance to win the prize. The transaction is now complete and legitimate. The fact that the chance happened to be the winning chance does not invalidate the already-complete transaction.
-BP