Here’s a write up I found interesting from bible study tools.
Again the kingdom of heaven is like unto treasure
By which is meant, not eternal life, the incorruptible inheritance, riches of glory, treasure in heaven; nor Christ, in whom are hid all the treasures of wisdom and knowledge, and all the riches of grace and glory; but the Gospel, which is a treasure consisting of rich truths, comparable to gold, silver, and precious stones; of the most valuable blessings, and of exceeding great, and precious promises; and reveals the riches of God, of Christ, and of the other world; and is a treasure unsearchable, solid, satisfying, and lasting: this is said to be
hid in a field.
The Gospel was in some measure hid, under the former dispensation, from the Old Testament saints; and for a long time was hid from the Gentile world; and is entirely hid from them that are lost, who are blinded by the god of this world; and even from the elect of God themselves, before conversion: this is sometimes said to be hid in God, in his thoughts, counsels, and purposes, and in the covenant of his grace; and sometimes in Christ; who is the storehouse of truth, as well as of grace; and may be thought to be hid under the Mosaic economy, in the types and shadows of the ceremonial law: but here "the field" means the Scriptures, in which the Gospel lies hid; and therefore these are to be searched into for it, as men seek and search for silver and hid treasures, by digging into mines, and in the bowels of the earth:
the which when a man hath found;
either with or without the use of means, purposely attended to, in order to find it; such as reading, hearing, prayer, and meditation: for sometimes the Gospel, and the spiritual saving knowledge of it, are found, and attained to, by persons accidentally, with respect to themselves, though providentially, with respect to God; when they had no desire after it, or searched for it, and thought nothing about it; though by others it is come at, in a diligent use of the above means:
he hideth;
which is to be understood not in an ill sense, as the man hid his talent in a napkin, and in the earth; but in a good sense, and designs his care of it; his laying it up in his heart, that he might not lose it, and that it might not be taken away from him: and
for joy thereof;
for the Gospel, when rightly understood, brings good tidings of great joy, to sensible sinners;
goeth and selleth all that he hath, and buyeth the field:
which is not to be interpreted literally and properly; though a man that knows the worth and value of the Bible, rather than be without one, would part with all his worldly substance for one; but figuratively, and denotes the willingness of such souls, who are led into the glory, fulness, and excellency of the word of God, the scriptures of truth, and of the immense treasure of the Gospel therein, to part with all that has been, or is dear unto them; with their sins, and self-righteousness; with their good names and characters; their worldly substance, and life itself, for the sake of the Gospel, and their profession of it: and may also design the use of all means, to gain a larger degree of light and knowledge in the Gospel. It seems by this parable, according to the Jewish laws, that not the finder of a treasure in a field, but the owner of the field, had the propriety in it; when it should seem rather, that it ought to be divided. Such that have ability and leisure, may consult a controversy in Philostratus
F12, between two persons, the buyer and seller of a field; in which, after the purchase, a treasure was found, when the seller claimed it as his; urging, that had he known of it, he would never have sold him the field: the buyer, on the other hand, insisted on its being his property; alleging that all was his which was contained in the land bought by him.