They gave him vinegar to drink mingled with gall: and when he had tasted [thereof], he would not drink.
Note 1 at Mt 27:34: There were two instances during the crucifixion when Jesus was given vinegar to drink. The first instance is recorded here (also Mr 15:23 and Lu 23:36), which may have taken place before Jesus was actually nailed to the cross. The second instance is recorded in Mt 27:48, Mr 15:36, and Joh 19:29; just before Jesus "gave up the ghost" (Joh 19:30), a sponge was dipped in vinegar and lifted to Him on the cross.
The "vinegar" that Matthew was speaking of was actually sour wine. The Greek word that is used here is "OXOS," and it "denotes sour wine, the ordinary drink of labourers and common soldiers" (Vine's Expository Dictionary). Mark, in describing this same instance, used the word "wine" as the drink that was given to Jesus. Wine is spoken of as vinegar elsewhere in Scripture (Nu 6:3 and Ru 2:14).
The sour wine was mixed with gall or, as Mark recorded it, with myrrh (Mr 15:23). Scholars differ on exactly what this gall was, but all agree that it had a narcotic effect that dulled the senses. Therefore, Jesus refused to drink, desiring to have His full senses and endure the complete extent of suffering for us on the cross.
The second time Jesus was offered this sour wine (Mt 27:48 and Joh 19:29-30), it was not mixed with anything but was simply given to quench His thirst and He received it.