"what for" and "why"? (what do you do that for?)

In Oxford dictionary,the sentence “what do you do that for?” has the same meaning with the sentence “why do you do that?”. But in his book Professor Thomas Elliott Berry said that the two sentences don’t have the same meaning. could you tell me whether they have the same meaning or not?

.
They have the same meaning for me.
.