You might be thinking of this scripture: Pro 23:23  Buy the truth, and sell it not; also wisdom, and instruction, and understanding.

Let’s look at it in a couple of other translations of the Bible:

(BBE)  Get for yourself that which is true, and do not let it go for money; get wisdom and teaching and good sense.

(CEV)  Invest in truth and wisdom, discipline and good sense, and don't part with them.

The thought is not to buy with money, but that Truth will cost you something.

God’s Truth is free to all who really, really search for it (“God is a rewarder of those who *diligently* seek Him.”). Like digging for hidden treasure. But once you have Truth it will cost you something.

It may cost you friends who don’t want to hear the truth.  It may cost you a job because you cannot lie. It may cost you church friends because you see a teaching that is wrong. Truth will cost you.

This verse teaches us that once we have the truth, we cannot “let it go for money”. We should never sell it. That is make deals with error or lies just to keep our friends happy.  We must buy it, that is, be willing to part with anything for it. He does not say at what rate we must buy it, because we cannot buy it too dear, but must have it at any rate; whatever it costs us, we shall not repent the bargain.

God’s Word is Truth. God’s Word is Free. But it does take a lot of work.

It is only by studying God’s Word that we can get understanding. All the answers are in there, but it is our job to search them out. God promises that if one truly seeks to know the Truth—He will give it to them.  We are told this searching is like searching for a treasure.

2Ti 3:16  Everything in the Scriptures is God's Word. All of it is useful for teaching and helping people and for correcting them and showing them how to live.

Joh 8:31  Jesus told the people who had faith in him, "If you keep on obeying what I have said, you truly are my disciples. 32  You will know the truth, and the truth will set you free."

God created this entire world—He does not need our money. It is already His. He wants our hearts and our loyalty that is all. Then we are Sons of God and God will give His sons everything they need—that includes Truth.

In the days of the Apostles one thought he could buy the gifts that the Apostles were giving to people. Peter explained that even they were free. So if the gifts were free, how much more free is the Truth.

Acts 8:20 (BBE)  But Peter said, May your money come to destruction with you, because you had the idea that what is freely given by God may be got for a price.