A counter is a flat-topped fixture in a store where business transactions take place. A counter can also refer to a machine that keeps count of something. A mathematician is someone that is concerned with numbers, data, or quantity. The joke is playing off the different meanings of the word counter and relating it to a mathematician. 
The best place for a mathematician is behind a counter .