You do both but not to the same extent. if you are just leaning over on the bike your center of gravity is to the inside of the corner compare to where your tyres are. Instead of pushing your tyres in to the dirt to get more grip you are pushing them across the top of the dirt = washout.
Lets clear up some misconceptions here.
Try this experiment: take something relatively long with a square edge, like a rule, a remote control, your phone, and stand it upright on a table. Now try and push it at the bottom, where it contacts the table, without it falling over. Then, lean it slightly into the direction you're pushing it, and try again. Then lean it some more, and try again.
What should be apparent is that the further away from vertical your chosen thing is, the faster you have to move it to stop it falling flat. Conversely, with it more upright, it is much easier to push the base "underneath", and it falls the other way.
Now, this is a decent enough analogy for what is happening when we negotiate a corner. Any change in direction requires a force in that direction, and in the case of cornering that force is pushing us towards the centre of the corner, by the only place it can- through the tyres.
So what do the results of our demonstration tell us? If we are cornering, we need the centre of gravity inside our wheels. If we lean our body far too much, we fall down inside the turn, and if we lean too little, we high-side and fall over the top of the bike to outside the turn. A corner is no different to riding in a straight line- if we are not balanced (forward/back and side/side), we are coming off.
Note that with the bike mass such a little proportion of the system (bike + rider) mass, it doesn't matter how much the bike leans. It also doesn't matter if the corner is flat/burmed/off-camber, and none of these situations involved a wheel washing out or loosing traction- Just that having the centre of mass to the inside of the tyres while cornering is a fundamental requirement to not falling on ones face.
Tangent:As an aside, it is perhaps counter-intuitive, but one of the best ways to generate the lateral forces at the tyres whilst shifting the weight inside the turn is to 'push' the hips outside the turn. I'm no sports scientist so it's hard to explain the movement, but you'll know it when you feel it... A side effect of this is for the navel to point in the direction we want to go, hence the advice. If someone is having issue turning one way but not another, sorting this movement out may go a long way to getting that fixed.
OK then, why then lean the bike at all? Well, as has been alluded to, (hopefully!) neither our tyres nor our trails are smooth, so we want to lean the tyre to get it onto the knobs which will give the most grip in the direction they are being pushed- either sideways into the corner, or sideways and backwards if we are braking through the corner. Which will generally be the side knobs. Happily, by virtue of committing our bodies into the inside while cornering, the bike kind of follows us and gets itself into this sweet spot without us having to think about it too much. of course, the times it doesn't are less than happy...
Now, if the tyre has more lateral (sideways) put through it than it has grip, it will disappear from underneath us or wash out... what if we were already on the sweet spot for grip? Thankfully, we can get more, we just need more weight on the that tyre. So if the front is washing, move your weight forward, if the rear is drifting, more weight back. Of course, the more we ask of one tyre, the less we can ask of the other. As with every other part of this, it's all about balance.
TL;DR: Weight the wheel, lean in, and let the bike follow.