## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the profit of a bookstore by determining the optimal number of hardcover and paperback books to display and sell.

### Decision Variables

- $H$: The number of hardcover books to display and sell.
- $P$: The number of paperback books to display and sell.

### Objective Function

The profit made on each hardcover book is $5, and on each paperback book is $2. The objective is to maximize the total profit:

Maximize: $5H + 2P$

### Constraints

1. The bookstore can display and sell at most 500 books:
   - $H + P \leq 500$

2. The bookstore must display a minimum of 50 hardcover books:
   - $H \geq 50$

3. At least 5 times as many readers prefer paperback books to hardcover books:
   - $P \geq 5H$

4. Non-negativity constraints:
   - $H \geq 0$
   - $P \geq 0$

Since $H$ and $P$ represent the number of books, they must be integers. However, Gurobi can handle integer constraints, but for simplicity and given the nature of the problem, we'll first solve it as a linear program and then consider if integer constraints are necessary.

## Gurobi Code

```python
import gurobi

def solve_bookstore_problem():
    # Create a new model
    model = gurobi.Model()

    # Define the decision variables
    H = model.addVar(lb=0, name="Hardcover")
    P = model.addVar(lb=0, name="Paperback")

    # Objective function: Maximize profit
    model.setObjective(5*H + 2*P, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(H + P <= 500, name="Total_Books")
    model.addConstr(H >= 50, name="Min_Hardcover")
    model.addConstr(P >= 5*H, name="Paperback_Preference")

    # Solve the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution found.")
        print(f"Hardcover books: {H.varValue}")
        print(f"Paperback books: {P.varValue}")
        print(f"Max Profit: {model.objVal}")
    else:
        print("No optimal solution found.")

solve_bookstore_problem()
```

This code sets up the optimization problem as described, solves it using Gurobi, and prints out the optimal number of hardcover and paperback books to display and sell in order to maximize profit, or indicates if no optimal solution was found. 

Given that the solution variables represent counts of items, they should technically be restricted to integer values. Gurobi can easily be adjusted to enforce integer solutions by setting the `vtype` attribute of the variables to `gurobi.GRB.INTEGER` when creating them:

```python
H = model.addVar(lb=0, vtype=gurobi.GRB.INTEGER, name="Hardcover")
P = model.addVar(lb=0, vtype=gurobi.GRB.INTEGER, name="Paperback")
```