He buried the treasure so that no one else would find it before he could buy the field.
After he bought the field, he could openly search for all of the treasure, and it would all be his.