We have a strategy that checks for different conditions and performs tax calculations as well if tax-inclusive pricing is enabled. You can read more about this in our documentation:
https://docs.medusajs.com/advanced/backend/price-selection-strategy/
Generally speaking, the lowest valid price is the price used for a product variant.