Yes, it will use the MX record and be delivered to the on-prem server
However, if the mx record points to Exchange Online and the sender is in Exchange Online, the mail will not go over the internet:
https://learn.microsoft.com/en-us/office365/servicedescriptions/exchange-online-service-description/mail-flow