This is a relatively recent development. It hasn't been a permanently solid blue state until the last half-decade.
Not too long ago, it had a multi-term, conservative Republican governor (LePage) and would regularly elect Republicans to the governorship. It elects a Republican U.S. Senator (although rather liberal) and used to regularly have Republican majorities in the legislature. Not surprisingly, these have been whittled down with the advent of all mail-in balloting.
Collins is a liberal, regardless of party, and shes been an installed fixture there for decades. Maine has been a liberal progressive place for a good while.