The mantra proper belongs to the medieval Tantric compendia, but the goddess and the vocabulary it draws on are far older: the Shri Sukta, the hymn from which shri as a word and shrim as a bija both descend, is a khila, a supplement appended to the Rig Veda rather than part of its original collection, and its own date is uncertain, plausibly late Vedic though it is impossible to fix precisely because khilas were added to manuscripts at different points across different transmission lines. By the time the Tantric formula fixed shrim plus mahalakshmyai plus namaha as a unit, Lakshmi had already absorbed Shri, an earlier and partly separate figure of abundance and sovereignty, into a single identity, so the mantra addresses a goddess who is herself the product of an older merger. Transmission since has run through Vaishnava temple practice, where Lakshmi is worshipped alongside Vishnu, and through Shakta practice, where she is one of the Mahavidyas or great goddesses in her own right, so the same words are received within two theologically distinct frameworks depending on which tradition teaches it.
Translating shri itself carries the dispute. It is sometimes rendered simply as wealth, which flattens a term that in the Vedic and classical literature covers auspiciousness, royal glory, beauty and the sheer fittingness of a thing being in its right place, a wider and more encompassing sense than money alone. Sanskritists generally prefer to leave shri untranslated for exactly this reason, on the ground that any single English word narrows a term whose semantic range is the point, and popular renderings that gloss the whole mantra as a request for money are considered by scholars of the tradition to miss what the goddess and the word were originally taken to mean.