It is difficult: for many people paying for things is a strong status signal, so your friend has to trust you are not being a dick. For a restaurant bill, I might suggest we each pay half an hours wages each (not really fair, but closer). If it is something they couldn’t otherwise afford it makes it easier since then I can pay. For those with spare time, I might suggest I pay for something, and they later do something that takes some small amount of time for me like have a meal at theirs and be sociable (again, avoiding status signalling work, it has to be something with respect on both sides).
Sometimes when I know someone has spent say their weeks disposable income when doing something together, I spend a weeks disposable income on something they need: the price discrepancy means they can’t repay it equally so they have to come up with another mental model. That can only be done nicely to some people (no one wants to feel in debt or obligated).
It is very dependant on each person and each situation, and there is no generic tidy way to deal with the discrepancy.