Your case A is obviously stealing because of your evil intention.

You do everything just to gain something even if you know that it is from the other person. You exerted effort just to have bitcoins that is not yours. In case B it is just pure luck. You have not done anything wrong as it is already in that bitcoin wallet. But would that happen? I mean having already a fund with the wallet address that is newly generated?