A very evil example of showing it can be done...
So you have a domain like example.com that you want to alias to anotherexample.com. What is happening is at the root of the example.com is an @ or base or apex record that per the RFCs must be an IP address.
$ORIGIN com. com. IN SOA ns.example.com. domain.example.com. (1 3H 15 1w 3h) example.com IN CNAME anotherexample.com. $ORIGIN example.com. example.com. IN SOA ns.example.com. domain.example.com. (1 3H 15 1w 3h) IN NS ns.example.com. IN NS ns.anotherexample.com. ns IN A 127.0.0.1 www IN CNAME anotherexample.com.
What we are doing
The goal here is to server example.com and CNAME it to anotherexample.com which is not supposed to work. What I am actually doing is creating a zone for .com and then answering with a CNAME for example.com then reseting the $ORIGIN quickly so the zone now becomes the zone for example.com. I also show the www.example.com CNAME as an example of how it is normally done and the base driver for this issue. In the browser address bar the user does not understand the difference between the two and this hack is a dangerous and silly hack to make the user happy.
Don't do this....
Only do this in a Lab or test setup to prove things out. People will not like you for doing this in the real world.
I glossed over a ton of details to keep this readable.
Please use with extreme caution and configure and secure your DNS infrastructure properly.