It means an offer is appreciated but declined.
The word ‘thanks’ appreciates an offer and at the same time the phrase ‘no thanks’ declines the offer.
Let us imagine a situation like this.
· John offers sweets to Mary.
· Mary appreciates the offer but doesn’t want to accept the sweets.
· She wants to convey rejection.
In this case, she will express the denial as, “Thanks, but no thanks.”