Here's why:
* "However" as a conjunctive adverb: When "however" is used to connect two independent clauses, it should be preceded by a semicolon.
* Example: "The weather was terrible; however, we still had a great time."
* "However" at the end of a sentence: When "however" is used at the end of a sentence, it is simply an adverb modifying a previous phrase or clause. It doesn't need a comma before it.
* Example: "We were hoping for a sunny day. It was raining, however."
In short, the placement of a comma before "however" depends on its grammatical function. It needs a semicolon when it connects two independent clauses, but not when it's at the end of a sentence.