Linksys Router
It appears that both dd-wrt and TomatoUSB firmware builds are available for the Linksys E4200. Both dd-wrt and TomatoUSB are Linux-based firmware. Either firmware can run either an OpenVPN client or a Tor client, but not simultaneously.
By the way, while the Linksys E4200 is adequate as a Tor client, it arguably doesn't have enough CPU or RAM to make a good Tor router. Its performance as an OpenVPN client is similarly limited. If you want more than 50 Mbps VPN traffic, you'll need better hardware. And by the way, DO NOT use HideMyAss as your VPN provider. They do not protect their users' privacy! EarthVPN also sells out its users.
Tor Tunneled Through VPN
"Tor tunneled through VPN" means just that. A VPN client running on a local device (computer or router) establishes a virtual private (securely encrypted) network connection (VPN tunnel) to the VPN service's exit server (perhaps through one or more intermediary VPN servers). Instead of seeing your ISP-assigned IP address, Internet observers see the exit server's IP address. It's rather like a virtual NAT router.
The Tor client reaches an entry guard through the VPN tunnel, circuits are established, and so on. Tunneling Tor through VPN is very easy. Both clients can run on the same computer, and the Tor client will connect to entry guards through the VPN. With proper network routing and firewall rules, all applications will connect to the Internet through the VPN tunnel. If the VPN connection dies, there will be no Internet connectivity, for the Tor client or any other application.
VPN Tunneled Through Tor
"VPN tunneled through Tor" is just the reverse. A Tor client running on a local device connects to entry guards and establishes Tor circuits. Then a VPN client connects with a VPN server through Tor. Because Tor can only route TCP traffic, you must run the VPN in TCP mode. Once the VPN tunnel is established, you can route both TCP and UDP traffic through it.
However, the mechanics of tunneling VPN tunnels through Tor is more complicated than tunneling Tor through VPNs. Unless you're a networking expert, the Tor and VPN clients must be on separate machines, or at least on separate virtual machines (VMs). If you run a Tor client on your router, for example, you can run a VPN client on one of your computers, and the VPN will be tunneled through Tor.
Which One To Use?
Which is better, "Tor tunneled through VPN" or "VPN tunneled through Tor", depends on your goals. It may be that you want both, "VPN2 tunneled through Tor, which is tunneled through VPN1". You might even want additional VPN nesting (one VPN tunneled through another) on either side of Tor, in order to further complicate traffic analysis.
With Tor tunneled through VPN, your ISP and associates don't see IP addresses of Tor entry guards. However, Tor traffic can be identified through its fingerprint/signature, and it's possible that it can be detected even though Tor is tunneled through a VPN. However, unless such analysis were performed routinely on all VPN connections, which seems unlikely, Tor users wouldn't be readily identified by ISPs and other local observers. Where discretion is particularly important, users could employ additional obfuscation.
Also, entry guards run by adversaries could not directly see your ISP-assigned IP address. With one VPN, it's not hard to trace users. But nested VPN chains (comprising 2-4 VPNs, tunneled in succession) take more effort to compromise, as long as all of the VPN services have many users, and if there are no money trails linking you to the VPN providers. The risk of compromise can be further reduced by using VPN providers that operate in poorly-cooperating spheres of influence.
With VPNs tunneled through Tor, all of your traffic through Tor exit relays is encrypted by the VPN. However, VPN exits can see any unencrypted traffic, just as Tor exit relays can. Using VPNs tunneled through Tor gives you a stable IP address, and allows you to access sites that block Tor exits. As noted, you can freely use any application over the VPN, as long as the VPN tunnel has been properly secured by routing and firewall rules.
On the other hand, tunneling VPNs through Tor reduces anonymity, because the circuit persists until the VPN connection is interrupted. That can be a long time, because VPN tunnels by design are very persistent and fault tolerant. Also, because traffic through the VPN doesn't interact with the Tor network, you won't be able to access Tor hidden services (except through Internet-to-Tor gateways).
Tunneling a VPN through Tor would be appropriate where you want to establish a persistent online pseudonym, and freely use all Internet resources and protocols, and yet do not want any of that to be linked to your true name and ISP-assigned IP address. In doing that, you're trading full Tor anonymity for usability. Indeed, if you're creating a persistent pseudonym, it's advantageous to create a highly-interconnected graph of Internet usage, because you look more like the rest. Indeed, you can create a complex network of identities, with some (such as mirimir) that seem to be pseudonyms for others (redacted).
Implementation
There are many ways to implement these setups. If you want a VPN or Tor client on the router, you'll probably need to decide which. It may be possible to have both clients installed on the router, and toggle between them at boot. But I don't know whether the Linksys E4200 has enough flash storage for both, or how hard it would be to toggle between them.
In my opinion, it's best to use either no client on the router, or the OpenVPN client. I like the flexibility of connecting directly (no VPN or Tor) for activities under my true name. And I prefer that my ISP and associates see that I'm using a VPN service, rather than Tor. That's because Tor use is arguably less common, and so attracts more attention. I run various VirtualBox host machines, with gateway VMs for VPN services and Tor, Linux workspace VMs and LiveCD VMs, Whonix VMs, and so on. For some work, I use such host machines as multifunction (VPN and Tor) routers for other host machines.
If you want more specifics about implementation, please ask a more specific question.