Heilbroner and Thurow, Economics Explained (1982, 1998):
Iron nails were so scarce that pioneers in America burned down their cottages to retrieve them.
Another writer (2003):
Nails at one time were so expensive and in such demand that it was customary for the owner to burn down an abandoned building in order to recover his nails. In 1645 the colonial authorities in Virginia offered to pay the owner of an abandoned building the worth of its nails if he would not resort to burning the structure.
For nails were imported articles and woefully expensive: so hard to come by were they that it was customary on abandoning a house, to burn it to the ground in order to collect the nails from the ashes. In fact, a special law was eventually enacted, in 1645, to prevent the practise:
"That it shall not be lawfull for any person so deserting his plantation as aforesaid to burne any necessary houseing that are scituated therevpon, but (he) shall receive so many nailes as may be computed by 2 indifferent men were expended about the building thereof for full satisfaction, reservinge to the King all such rent as did accrew by vertue of the former grants or planting of the same from the expiration of the first seaven years."
The quoted 1645 law can be found here.
A blog-post briefly argues it's a myth:
during the earliest years of the colonial period—the first few decades of the 1600s—buildings were constructed in a very slipshod manner, with wood touching the ground. They were meant to be temporary, because the earliest settlers hadn’t planned to “settle” at all–they were here in the New World to make a quick fortune and go home. So they built shoddy buildings that quickly rotted. Therefore, it was an occasional thrifty practice to get rid of these shacks by burning them, but then, why not sift through the ashes for the nails? ... the nails weren’t all that valuable, but why waste them?
The law aimed to stop Englishmen from deserting their plantations and from burning the buildings as they left (and taking the nails with them) by giving them the estimated number of nails.
The above debunking seems plausible, but I wonder if there's a more thorough and well-researched account of whether this is really a myth.