Jesus was God, but was not fully empowered at the time. Remember the passage from the Gospel which says Jesus could not yet send the spirit because He was not yet glorified?
Because of His human nature, He was tempted in the desert. But the quote from James, written many years after the event, proclaims the “result” of Jesus’ successful rejection of temptation.
In other words, Jesus is God - Jesus “was” tempted by the devil before His full glorification - the temptation failed - Jesus has now been glorified - therefore… God cannot be tempted by evil. If God, even in the partially vulnerable form of the son of man could not be tempted successfully, He certainly cannot now that the son of man has been fully glorified and empowered.