Yet practically speaking, there's something weird about this. There are lots of voluntary transactions that don't provide value, perhaps significantly subtract value. Gambling, for example or other addictions (drugs, porn, etc) where one party is making a lot of money from the addicted person does not seem value-adding at all.
The value is freedom. And you can't put a price on freedom.
So I fully agree with @siggy47 here:
The person voluntarily engaging in the transaction decides if it has value, financial or otherwise. Period.
Sometimes, it's really just that simple. No need to make it complicated.
But is trading of fentanyl by an addict and dealer really a value-providing transaction?
It is, depending on how you define value. If it's subjective (which I think it is), it's value for both parties and if you want to add society to that equation, you also need to think about opportunity costs. What if that transaction does not happen? Will the problems of addiction magically go away? According to my experience, that's not the case.
I think you're letting your own personal biases show too much in this post here. Imo, drugs aren't the problem but just a symptom of the conditions in which humans find themselves. So the situation is the problem, not necessarily the drug.