In regards to price, it's not really apples to apples for several reasons unrelated to operating system. For one thing, Lumia positions itself as the best build quality among Windows phones, and usually includes a better camera than comparable Windows Phones and Android phones, especially if it has Zeiss optics and/or Pureview. The price difference shows this, even on Microsoft's USA site, Blu and YezzBilly brands are noticeably cheaper if you go strictly by basic specs. Second, Lumia 640/XL is the newest Lumia model, so like with everything else, the initial launch price is going to be relatively high, chances are the price drop will be greater compared to the models you mentioned within the next 6-12 months, swinging the value equation more in the 640's favor.
One area where mid-range Lumia's still beat the competition is the expandable memory, 128GB and probably more. For me, this is usually the most glossed-over but important spec, because having offline videos/photos/music (not to mention more room for apps) makes a noticeable difference in responsiveness and reliability and battery life. I had an Android phone that supported only up to 32GB card, and without any pictures/videos/music I was hitting the limit on both the phone and card, and I was constantly juggling which apps to un-install and install. For me, that alone makes Lumia better, among other things.
WW