Trade in vs personal sell or Carvana, Car Max, etc?

For a tax advantage is is best to trade your car in to lower the purchase price thus lowering your tax liability when you buy or go and sell various ways and just plop tha that total down as a down payment? I suppose one would have to calculate the math either way? Dunno