One of the longstanding puzzles of antimicrobial resistance is why the frequency of resistance persists at intermediate levels. Theoretical explanations for the lack of fixation of resistance include cryptic costs of resistance or negative frequency-dependence but are seldom explored experimentally. beta-lactamases, which detoxify penicillin-related antibiotics, have well-characterized frequency-dependent dynamics driven by cheating and cooperation. However, bacterial physiology determines whether beta-lactamases are cooperative, and we know little about the sociality or fitness of beta-lactamase producers in infections. Moreover, media-based experiments constrain how we measure fitness and ignore important parameters such as infectivity and transmission among hosts. Here, we investigated the fitness effects of broad-spectrum AmpC beta-lactamases in Enterobacter cloacae in broth, biofilms, and gut infections in a model insect. We quantified frequency- and dose-dependent fitness using cefotaxime, a third-generation cephalosporin. We predicted that infection dynamics would be similar to those observed in biofilms, with social protection extending over a wide dose range. We found evidence for the sociality of beta-lactamases in all contexts with negative frequency-dependent selection, ensuring the persistence of wild-type bacteria, although cooperation was less prevalent in biofilms, contrary to predictions. While competitive fitness in gut infections and broth had similar dynamics, incorporating infectivity into measurements of fitness in infections significantly affected conclusions. Resistant bacteria had reduced infectivity, which limited the fitness benefits of resistance to infections challenged with low antibiotic doses and low initial frequencies of resistance. The fitness of resistant bacteria in more physiologically tolerant states (in biofilms, in infections) could be constrained by the presence of wild-type bacteria, high antibiotic doses, and limited availability of beta-lactamases. One conclusion is that increased tolerance of beta-lactams does not necessarily increase selection pressure for resistance. Overall, both cryptic fitness costs and frequency dependence curtailed the fitness benefits of resistance in this study. Antimicrobial resistance is a pressing healthcare challenge. A key issue is understanding the conditions that can increase or decrease the rate of resistance spread, i.e. bacterial "fitness". Important questions include how antibiotic doses affect the fitness of resistant bacteria. Secondly, we know that bacteria in infections can behave very differently from bacteria in laboratory conditions: they can grow more slowly and are typically more tolerant of antibiotics. Another important question is whether this higher level of tolerance makes resistance more likely to spread. However, measuring fitness in animal models (and especially humans) can be very challenging as we need to know precisely the proportion of resistant mutants and wild-type susceptible bacteria at the beginning and end of infections.In this study, we used gut infections in a model insect host to study how antibiotic doses and initial prevalence of resistance affect the fitness of resistant bacteria: we compared these results to experiments with fast- and slow-growing bacteria in the laboratory. Our study focused on beta-lactamases, resistance genes that break down clinically important penicillin-based or "beta-lactam" antibiotics. We observed that some wild-type bacteria within infections exhibited high susceptibility while others demonstrated high tolerance, similar to bacteria in biofilms. Key findings were that wild-type bacteria in infections could be protected by resistant mutants breaking down antibiotics, even at very high doses. Overall, the fitness of resistant bacteria in infections was restricted by a surprising number of factors. In particular, resistant bacteria had low fitness at high antibiotic doses, while resistant mutants were also less able to colonize hosts compared to their susceptible counterparts. Experiments in insect models can shed light on some important microbiological questions, such as how tolerance of bacteria in infections and different antibiotic doses are likely to affect selection for resistance.