If Lugano gets 3m net per year, then it's 5.17 gross
5.17 X 3 = 15.5m eur for his wages.
With some 3m eur transfer fee he will indeed cost us ~18m eur for 3 years
It seems a lot but that's because we often forget to calculate the wages when we talk about the cost of a single player.