I’d like to offer a different perspective to cut your pastor some slack. Not because I believe the answers here are all wrong, but because this site functions at its best when multiple perspectives are exchanged—and there are rational people who have read this passage different ways. That doesn’t mean they’re all right—but it doesn’t mean they’re all wrong either.
It’s worth exploring what is meant by “free” and “gift”
We should be careful about decontextualizing what is meant by “free”. Economists are fond of pointing out “there’s no such thing as a free lunch,” because somebody paid for it. In the case of salvation, in an absolute sense it is neither free nor cheap—it cost the blood of Jesus Christ (see Hebrews 9:12).
The gift is freely given, but it certainly was not free (see Romans 8:32).
The Greek word behind the key references in the OP is charis (χάρις). I find the Romans 5:15 translation of the related χάρισμα as “free gift” from KJV, NASB, RSV, etc misleading. More careful (in this case) is the NIV, which omits the word “free”.
Brent Schmidt has written about the use of the word charis in Greco-Roman literature (see here) and the historical context is extraordinarily valuable.
The cliff-notes version: charis does not describe a “free lunch”; in Paul's day it described an asymmetric, reciprocal gift relationship. The giver offers something that the receiver could not hope to earn, but the receiver cannot simply take the gift and run—there are expectations of the recipient. The word charis does not describe a mere transaction, it describes a relationship.
Paul’s use of charis is a very effective description of a covenant. Romans 5:15 then describes a covenant relationship in which God provides the terms of the covenant and gives what could never be earned. The recipients enter into that covenant and take upon themselves sacred obligations—more on that below.
“All that he had”
As Revelation Lad already observed, 1 Corinthians 6:20 points out that we are bought with a price.
Additionally, Jesus’ teachings to the rich young ruler point out what Jesus expects of His followers (see Matt 19:16-22). The man was not asked to donate a particular amount; he was asked to donate what he had.
Paul himself understood well that being fully committed to Christ required great sacrifices (e.g. 2 Cor. 11:23-28, Acts 20:19-24).
In this asymmetric grace relationship what did Jesus give? Everything.
In this asymmetric grace relationship what are we asked to give? Everything.
(Our "everything" is not remotely comparable to Jesus’ "everything")
To build upon comments I shared in another post, if we say that we want God to forgive us but we don’t want Him to change us, we are completely missing the point. The point of Jesus asking everything from the rich young ruler, and asking everything of us, is not to pay for what He’s giving us, but to change us. To put it more poetically:
He is like a refiner’s fire
He wants to change my desire
His commands do not extract payment of a fine
They are given, His people to refine
(see also Malachi 3:3)
The things that are required of us (e.g. Matthew 7:21) do not pay for salvation; their purpose is not transactional, but transformational.
That’s probably about as far as I ought to go on a hermeneutics site. If anyone is interested, my theological thoughts on grace are found cumulatively here and here.
When the parable describes the merchant giving up “all that he had”, it can effectively describe Jesus’ descent from glory to rescue humanity (see John 17:5), and it describes what He has asked of us.
If the merchant in the parable is likened unto us, the emphasis is not on “buying” or “selling”—these transactional terms are used to convey cost and sacrifice—the emphasis is on the willingness to commit all that we have.
To borrow a common phrase, we can receive eternal life, but only if we’re willing to prioritize it above everything else. If there is there anything we are not willing to give up—this was the point Jesus made to the rich young ruler—then it is that very thing that stands in our way of fully receiving His gifts.
In that sense we, like the merchant, are expected to be willing to give all that we have. Could that sacrifice mean dying for one’s faith? It certainly did for Peter, Paul, and others. But what if it means living for our faith—are we willing to do that too?