Before the common conception of a nail (something to attach objects), a nail was a post with a flat head used for cash transactions at a market. You can see some in Corn Street bristol outside the Corn Exchange. When someone agreed to buy something the trader and the buyer would go outside and some money was placed onto the top of the nail. When the seller was satisfied with the amount tendered, he would pick up the money and the deal was done. Hence the expression "Cash on the Nail". To hit the nail on the head may have a similar meaning.