Certainly, but the cost (in this case probably even the actual cost, but mostly in terms of impact on everyday life) is vastly higher with masks - they're inconvenient and annoying, and make social interaction harder.
Meanwhile, air purifiers use a bit of power (probably less of an environmental impact than the inevitable littering of masks which are basically all microplastic while looking like harmless paper), probably cost less per filter change than a week's supply of mask, and have a relatively negligible comfort impact.
Meanwhile, air purifiers use a bit of power (probably less of an environmental impact than the inevitable littering of masks which are basically all microplastic while looking like harmless paper), probably cost less per filter change than a week's supply of mask, and have a relatively negligible comfort impact.