First you need a little background on old Japanese currency. Back in the Edo period, a {} was the lowest denominator of currency. A {} is a weight measurement (3.75 kg), but is also the weight of 1000 , which were stringed together to make 10 rolls of 100 coins and those rolls themselves would be used in payment.
comes from , which is 100 short of a . So it is inferring that the person is lacking intelligence, though from my research I can't tell if the phrase is literal (cannot properly count and therefore a fool) or metaphorical (likening the person to a short 100 ).
Incidentally, there is a similar saying in English: "a few cents short of a dollar." This one is definitely used metaphorically, meaning the person is not "all there".