I asked my neighbour (who works for the Border Agency) about this, and she said that whilst technically they are not allowed to ask where you have been they do do this for a number of reasons. One is to engage you in conversation, to check that you do speak English with an English accent, another is to find out which flight you have been on as they sometimes have targets on certain flights, so finding out which flight you have come off helps them to establish whether people from the targets flight are passing through immigration yet. And sometimes, she says, the person in immigration is just a bit bored and is looking for conversation, and how better to start it at immigration than asking where you've been!