Once, when the Buddha was staying at the Nigrodhārāma in Kapilavatthu, Pajāpatī Gotamī offered him two lengths of cloth woven by herself on her own loom. The Buddha asked her to present her gift to the Confraternity of monks rather than to him, for she would thereby gain greater merit. He then proceeded to describe the different kinds of recipients of gifts, the different kinds of givers and the degrees of purity in gifts (M.iii.253ff).
The sutta is found word for word in the Sūtrālankāra (Sylvan Levi: JA.1908, xx.99) and is often quoted. E.g., Mil.258; MA.i.152; also included in anthologies - e.g., the Sutta-Sangaha.