Is the most reasonable price to charge a b2b client relative to the returns on investment?

For example, if I work with a rate of 40$/h, but the job that I did earns my client less than what they paid me, obviously there would be no point in hiring me, right?

So I guess it would make more sense to charge my client the amount relative to what they would most likely gain from my work, possibly as a percentage or a commission?

The main question I wanted to ask is - is it ok to ask my client questions such as what their average profit per client is, in order to evaluate whether my work would be effective to them in terms of profitability?

Thank you.