Beating the bounds is indeed a very ancient custom. The web page listed above by Dr. Bill mentions church accounts dated 1670 which list compensation to the "boys that were whipt". While not conclusive, that is not the normal stuff of urban/rural legend. I have heard it said (can't remember where) that the beating was to indicate to outsiders what they would get if they ventured across the lines uninvited. As there were usually no real takers, they had to pay local urchins to play the role of the invader.

Rod