EJBs are distributed elements, which need the RMI framework for object distribution. An EJB application server gives more services like object pooling, transaction management, database connection-pooling etc, which RMI does not produce. These extra services that are provided by the EJB server simplify the programming effort at the cost of performance overhead compared to plain RMI. So if performance is important than pure RMI may be a good solution.
The decision to go for EJB or RMI or Sockets should be based on needs such as maintainability, ease of coding, performance, extensibility, scalability, availability of application servers, business needs etc.