It's normally a joke.
It's 'funny' because "What can I do you for?" is actually a question that would never be asked, except rhetorically.
Do you, as in "I'm gonna do you in" is what a thug would say before he perpetrated violent acts against you. It could also be used by a police man, for example "Do him for possession", so do him is slang for arrest him.
There is also, the more pertinent definition of do you, which is what a swindler would think when tying to think how to trick you: "What can I do you for?" Where what they mean is "What can I get out of you with my tricks?"
Whereas "What can I do for you?" is someone simply asking how they can help. In the context of a barman, it would be asking what drink or other pub service they can provide.