Yes, 棉花糖 refers to both marshmallow and cotton candy.
Marshmallow is like a cotton boll or a cotton pad while cotton candy is like a loosen cotton boll. Both are cotton-like candies.
It is nothing new that a name refers to two things. People name novelties with their first impression.
It is a very common phenomenon. Look up the definitions of "recorder" in a dictionary. It refers to an recording apparatus, a wind music instrument, and a person who keep record.
棉花軟糖 is a name seldomly used. People use 棉花糖 exclusively in daily life. So do marketers. Marshmallow is a kind of very common commodity while cotton candy not. In daily conversation, if you mention 棉花糖 with no particular scenes or hints, people will recall marshmallow first.