In cases of mutual intelligibility, it is the political entities that are responsible for the separation. Sometimes it is a matter of ethnic groups sharing a language or speaking two dialects of it (e.g. Serbian and Croatian, Bulgarian and Slavic Macedonian). In other cases the political entities do not matter, therefore the same language (by name) is spoken in different countries e.g. (Greek in Greece and Cyprus, Swahili in Tanzania, Kenya, Uganda).
In linguistics you treat languages or dialects practically for what they are. However, that is not an easy task either. Two languages with 88% common vocabulary might be more intelligible because of shared phonology, than two dialects that share 93% of the vocabulary. So, what is a language and what is a dialect in that case? An example can be seen within Swedish, where certain west-Swedish dialects might share more with eastern- Norwegian dialects, than the south-most Swedish dialects.