First off, there's a writeup of the ej22 swap into your loyale. Find it here:
http://www.ultimatesubaru.org/forum/showthread.php?t=69741
I am not sure on the AWD tranny from the legacy and how it would fit but a custom Xmember seems like it would be needed. Otherwise the only other AWd tranny is from the 87-89 RX's that had the full time 4wd with the center diff lock. To swap one of those in you would want to contack Bratsrus1 and get his 5speed conversion kit. Its TOTALLY worth it, making the 5 speed bolt rite up. The RX tranny uses 25 spline axles, so if using stock suspension, you'd need a custom axle with a 23 spline inner and a 25 spline outer. If you want to do the 5 lug conversion at the same time here's the link:
http://www.ultimatesubaru.org/forum/showthread.php?t=50400
I had a bracket made for the ea82/5speed rear driveshaft that bolts to the floorboard underneath the seats.
Thats a start I hope it helps.