Are there any cases where two varieties of the same language are treated as separate languages, or where two distinct languages are treated as varieties of the same language. If so, why?
You're using the words "language" and "dialect" as if they were mutually exclusive: as if some people spoke "languages" and other people spoke mere "dialects." But that's not how linguists use those words. Think of them instead as referring to two different levels on the same hierarchy.
For instance, I speak the Midland US dialect of English. Asking whether I speak a dialect or a language is like asking whether I was born in Michigan or in the United States. The answer is "both," because one includes the other. Saying "I don't speak a dialect, I just speak proper English" would be like saying "I don't live in a state or territory or in Washington D.C., I just live in the US," which is pretty much nonsense.
So maybe it makes sense to rephrase your questions, like so:
In both cases the answer is "yes." For #1, look at Serbian, Croatian and Bosnian. Most linguists consider these all to be local varieties of the Serbo-Croatian language, but native speakers will insist that they're different languages. For #2, look at the language situation in China, where for instance Mandarin and Cantonese are treated as varieties of the same language even though they're distinct languages by any non-political standard.
*Most linguists wouldn't consider "dialect" to be derogatory. But in non-technical talk, it is often used derogatorily — as in "That's not a real language, it's just a dialect." So I like to use the word "variety" just because it makes it clear that I don't have any derogatory meaning in mind. That's just a personal preference, though, and as far as I'm concerned if you want to say "dialect" that's fine too.