You can do that machang. But it's illegal AFAIK.
You pay taxes for the country through the air line whenever you buy an air ticket.
So if detected in the airport that you've purchased the ticket from SL, then you're in trouble.
[But I did it once and didn't get caught

]
And yes, Malaysian fly from Mel to CMB. As many said, on code share basis. Means, from Mel to KL it's Malaysian. And from KL to CMB it's Sri Lankan.