The variable rasterpath is a loop variable and contains the last iterated value from the previous loop, and can not contain the path of the reoccuringreoccurring raster.
Try something like this instead [sorry - bit clumsy and not tested]:
import arcpy, sys,os
import re
import collections
rasterlist = []
inputRasters = arcpy.GetParameterAsText(0)
for rasterpath in sorted(inputRasters.split(';')):
Ras = str(os.path.basename(rasterpath))
rasterlist.append(str(Ras))
rasterlist = sorted(rasterlist)
arcpy.AddMessage(rasterlist)
counter = collections.Counter(rasterlist)
for key, value in counter.items():
if value > 1:
arcpy.AddMessage(key)
for rasterpath in sorted(inputRasters.split(';')):
Ras = str(os.path.basename(rasterpath))
if Ras == key:
#this is where you have identically named rasters and can do the mosaic
#in this instance the rasterpath variable does contain the path+name of a raster which has the same name as another