LoRa has become one of the most promising networking technologies for Internet-of-Things applications. Distant end devices have to use a low data rate to reach a LoRa gateway, causing long in-the-air transmission time and high energy consumption. Compared with the end devices using high data rates, they will drain the batteries much earlier and the network may be broken early. Such an energy unfairness can be mitigated by deploying more gateways. However, with more gateways, more end devices may choose small spreading factors to reach closer gateways, increasing the collision probability. In this paper, we propose a networking solution for LoRa networks, namely EF-LoRa, that can achieve energy fairness among end devices by carefully allocating network resources, including frequency channels, spreading factors and transmission power. We develop a LoRa network model to study the energy consumption of the end devices, considering the unique features of LoRa networks such as the LoRaWAN MAC protocol and capacity limitation of a gateway. We formulate the energy fairness allocation as an optimization problem and propose a greedy allocation algorithm to achieve max-min fairness of energy efficiency. Extensive simulation results show that EF-LoRa can improve the energy fairness by 177.8%, compared to the stateof-the-art solutions.