Yes, it is perfectly legal. Your company's contractual or billing arrangements with the customer has nothing to do with what they pay you. They can bill the customer anything they want (including a per diem) and then pay their employees whatever they want; receiving a per diem from the customer does not mean they have to pass it on to you.