Yes. You need no residence permit to buy: the law ties ownership neither to nationality nor to residence, and a non-resident signs the same contract before the notary as someone living in Germany. Status affects other things — taxes, banking and, for Russian citizens, the €100,000 deposit limit under EU sanctions — and the purchase itself confers no right to a residence permit.
What to check:
• your passport and proof of authority; if you will not attend, a power of attorney in the form required by § 29 GBO;
• registration with the tax office where the property is located, and the annual return;
• for Russian citizens without a residence permit in the EU, EEA or Switzerland, the €100,000 deposit limit at any one bank;
• how your country of residence taxes income from Germany and whether it credits the German tax;
• if you plan to move, the tax consequences — before the move, not after.