Body Language: Why do we give each other the grumpy/frowning fake smile?
Since this (excellent) question has been around for a while without any answer, I thought I'd give my two cents. 

I think we do this as a gesture of respect to the other person. We may fear that if we don't acknowledge them at all, it will come off as rude or arrogant. Maybe we fear that if we don't even look at the other person, we're basically pretending as if they're not there. So we want to acknowledge them in some way. However, they are often a total stranger, so we may feel that saying "hi" or anything like that, is a bit over the top. (Sometimes we may actually say "hi" combined with the frown, though.)

So, as you suggest in the question itself, it's a way to acknowledge the other person.

Now, why not give an authentic smile? Well, because it's a little bit difficult to give a real smile without actually being happy about something. If you see a dear friend for the first time in months, you'll probably give a real smile, because you are genuinely happy to see them. When you meet a total stranger, the truth is that that person doesn't really mean much to you. You might not really feel that you have anything to smile about. 

Have you ever tried to smile for a photograph, when you're actually not very happy? It's not easy. The smile often looks inauthentic. Similarly here, we try our best to greet the passing person with respect, but it's not that easy to smile authentically.

Not wanting to look like a fake smiling clown, we may not even try that hard. The other person knows that we're just trying to acknowledge them. They're not looking to give us an Oscar award anyway. And we know that they know that.

If we were to make eye contact with them without altering our facial expression at all, we might end up looking a bit mad. (Imagine it, you cross paths with someone, and they just look into your eyes without altering their facial expression at all. Personally, I would be a bit freaked out if that happened.) Most changes in our expression will be better than nothing (except, of course for a downright hostile or angry face). It means we acknowledge that they are there, and we are making an effort to do so.

There's another possible reason: Fear of rejection. We want to acknowledge the person. So why not give them a real smile? Well, what if you do, and they respond with a careful nod, a frown like the ones in OP, or even totally ignore you? (This is quite possible, since it's not that easy to produce a genuine smile.) When you genuinely smile at someone, you are giving a little part of yourself out to them. If they then merely nod at you, or something like that, most people will feel uncomfortable. As if they just gave someone a gift and the other person was uninterested in the gift. I'm not saying this is a reasonable feeling, I'm just saying it's the way people might feel, thus motivating their behavior.