It is said that the prohibition of usury was in Madinah, while the Prophet, peace be upon him, mentions this in his pilgrimage speech in Makkah.
Yes, verses 275-279 of Surah 2, which speak of the prohibition of usury, were revealed in Madinah, before the Prophet’s pilgrimage at the end of year 10. When he spoke about usury in his pilgrimage speech, he was giving details of the extent of prohibition.
There is no contradiction between the two. In fact the speech gave more information about something already established, namely, the strict prohibition of all usurious transactions. He stated that all such transactions were, on the basis of the prohibition already established in the Qur’anic verses are null and void.