Moving the interrogative pro-adverb to the end of a question
Solution 1:
In writing, you would almost always use the (proper) first form of your questions. The second form is typically only used in informal speech, and generally accompanied by a generous dose of disbelief (sometimes even outright sarcasm), with heavy emphasis on the why/how.
I would see it as a way of intentionally beginning the sentence as if you were making a statement, and then, as though suddenly stumbling over an internal doubt, turning it into a question, encouraging others to recognise and share that same doubt.