When this verse was revealed, "And upon those who are able to fast, but with hardship, a ransom of feeding a poor person" [Baqarah 2:184], whoever wished could break his fast and pay the ransom, until the verse that came after it was revealed and abrogated it.In another wording, during Ramadan in the time of the Messenger of Allah ﷺ, whoever wished would fast and whoever wished would break his fast and pay a ransom by feeding a poor person, until this verse was revealed, "So whoever among you witnesses the month, let him fast it" [Baqarah 2:185].
لما نزلت هذه الآية: {وعلى الذين يطيقونه فدية طعام مسكين} [البقرة: ١٨٤] كان من أراد أن يفطر ويفتدي، حتى نزلت الآية التي بعدها، فنسختها. وفي لفظ: كنا في رمضان على عهد رسول الله ﷺ من شاء صام، ومن شاء أفطر فافتدى بطعام مسكين، حتى أنزلت هذه الآية {فمن شهد منكم الشهر فليصمه} [البقرة: ١٨٥].
Bukhari related it in tafsir (4507), and Muslim in fasting (1145), through the route of Qutayba bin Saeed, who said, Bakr bin Mudar narrated to us, from Amr bin Harith, from Bukayr bin Abdullah bin Ashaj, from Yazid, the freed slave of Salama bin Akwa, from Salama, and he related it. Their two wordings are the same, and the other wording belongs to Muslim.