'Abdullāh Ibn 'Abbās / Muḥammad al-Fīrūzabādī
تفسير : allah then mentions almsgiving that is done in the open and that which is done secretly because they asked about it, saying: (if ye publish) if you show (your almsgiving) which is obligated upon you, (it is well, but if ye hide it) the supererogatory almsgiving (and give it to the poor) the folk of the platform (ashab al-suffah), (it will be better for you) than giving it in the open, but both are accepted from you, (and will atone for some of your ill deeds) in proportion of your almsgiving. (allah is informed of what ye do). he knows of the alms that you give.
Jalāl al-Dīn al-Maḥallī
تفسير : if you proclaim, make manifest, your voluntary almsgivings, that is, your supererogatory deeds, it is a fine thing, to show them; but if you conceal them, and give them to the poor, that is even better for you, than making them manifest or giving it to the rich. as regards the obligatory almsgiving, it is better to make it manifest, so that it serves as an example and so that one is not accused [falsely of not giving]; as regards giving it to the poor, this is obligatory; and it will absolve you of, some of, your evil deeds (read yukaffir, ‘it will absolve’, or nukaffir, ‘we will absolve’, either in apocopated form [with no final vowel, yukaffir, nukaffir], being a supplement to the locus of fa-huwa, ‘that is’, or with nominative inflection [yukaffiru, nukaffiru], indicating the beginning of a new sentence). god is aware of what you do, knowing its inner and outer aspects, nothing of it being hidden from him.
Ali ibn Ahmad al-Wahidi
تفسير : (if ye publish your almsgiving…) [2:271].
said al-kalbi: “when the saying of allah, exalted is he, (and whatsoever good thing ye spend…) [2:272], the companions asked: ‘o messenger of allah! is giving alms in secret better or giving it in the open?’ in response allah revealed this verse”.