Answer: First, let us take a look at the verses you mentioned that concern Jesus and his disciples buying swords.
And He (Jesus Christ) said to them (his twelve disciples), "When I sent you (on training missions) without money bag, knapsack, and sandals, did you lack anything? . . . But now . . . he who has no sword, let him sell his garment and buy one . . . For the things concerning Me have an end."
So they (the disciples) said, "Lord, look, here are two swords." And He said to them, "It is enough" (Luke 22:35 - 38, NKJV).
It is difficult to imagine Jesus telling his disciples to buy swords, considering that he would soon state the following.
". . . for all those who take up the sword shall perish by the sword" (Matthew 26:52, NASB).
'Put your sword back in its place,' Jesus said to him . . . (Matthew 26:52, NIV).
Also, it was late in the day, and Jesus and his disciples would soon leave for the Mount of Olives. He had much to discuss with them before he would be taken prisoner, so there would be no time to go to the market, argue for the best value for their garments, then haggle over the price of swords.
It is interesting that no Strong's Concordance definition is listed for the noun "sword" in the KJV Bible translation of Luke 22:36. Bishop Pearce, according to Adam Clarke's Bible Commentary for the verse, believes the word has been inserted from what is said in verse 38, as it is evident Jesus never intended any resistance to his capture, nor to allow such a weapon like a sword to be used on the occasion.
But in Luke 22:38 Strong's Concordance acknowledges the Greek word machaira (Strong's #G3162) is defined as a knife, dirk or sword.
If we back up to verse 35 we hear Jesus reminding his disciples that he had sent them on a temporary journey with neither purse nor passports, nor shoes (see Matthew 10:5 - 10). When he asked if they lacked anything during the trip, they answered, "Nothing." But when Jesus was no longer with them, their journey would not be temporary.
The disciples would need certain provisions, including a knife for preparation of food, cutting wood for fuel, and possibly to fend off robbers for which the area was noted. So, once Jesus' ordeal was over, they should make sure they each had a knife.
In Luke 22:38 the disciples said they had two knives, and Jesus said, "It is enough." By this he may have been saying that's all they would need, but Bible commentators Adam Clarke and John Gill believe he was saying, "We've talked about this enough." They are likely correct since, according to Luke's account, he then left for the Mount of Olives where his real agony would begin (Luke 22:39). Discussion about swords would be insignificant in comparison.