Just a decent frame, fork, and wheelset will blow your budget up, even used. Add the other bits (shifters, derailers, brakes, seatpost, clamp, saddle, stem, bar, cables, grips), and you're looking at $800 minimum for something you can ride offroad.
You may know what you want, but it is far from attainable at your budget.
You'll need to compromise, find a used hardtail, and for $400, it will probably be older and low end. It won't have an air fork, it might have rim brakes, and it might weigh 29lbs. Buy that, ride it, enjoy it, and save your money to upgrade down the road.
The problem is that you're buying at a really bad time. It's a sellers market, demand is high, and supply is low. And sadly, whatever you buy today will be worth half that when this craziness ends, maybe 6 months from now.