A positive integer $N$ is given. Panda builds a tree on $N$ vertices, and writes a real number on each vertex, so that $1$ plus the number written on each vertex is greater or equal to the average of the numbers written on the neighboring vertices. Let the maximum number written be $M$ and the minimal number written $m$. Mink then gives Panda $M-m$ kilograms of bamboo. What is the maximum amount of bamboo Panda can get? 
1. **Renaming and Initial Considerations**:
   - Rename \( N \) to \( n \).
   - We need to show that the maximum possible weight of bamboo Panda can get is \( (n-1)^2 \) kilograms.
   - For \( n = 1 \), \( M = m \), so \( M - m = 0 \). Hence, the statement holds trivially.
   - Assume \( n \geq 2 \).

2. **Constructing a Valid Tree**:
   - Consider a path graph on \( n \) vertices labeled \( 0 \) to \( n-1 \).
   - Write the number \( i^2 \) on the \( i \)-th vertex.
   - Here, \( m = 0 \) and \( M = (n-1)^2 \), so \( M - m = (n-1)^2 \).

3. **Verifying the Average Condition**:
   - For terminal vertices:
     - \( 0^2 + 1 \geq 1^2 \) and \( (n-1)^2 + 1 \geq (n-2)^2 \).
   - For a vertex \( 1 \leq i \leq n-2 \):
     \[
     i^2 + 1 \geq \frac{(i-1)^2 + (i+1)^2}{2}
     \]
     - This simplifies to:
     \[
     i^2 + 1 \geq \frac{i^2 - 2i + 1 + i^2 + 2i + 1}{2} = i^2 + 1
     \]
     - The equality holds, so the construction is valid.

4. **Proving the Upper Bound**:
   - Root the tree at a vertex labeled \( M \).
   - Let \( n_u \) denote the size of the subtree of vertex \( u \).
   - Let \( p_u \) denote the parent of vertex \( u \).
   - Define \( x_u \) as the real number written on vertex \( u \).

5. **Claim**:
   - For any vertex \( u \) other than the root, \( x_{p_u} - x_u \leq 2n_u - 1 \).

6. **Proof of the Claim**:
   - **Base Case**: If \( v \) is a leaf:
     \[
     x_v + 1 \geq x_{p_v} \implies x_{p_v} - x_v \leq 1
     \]
     - Since \( n_v = 1 \), the bound holds.
   - **Inductive Step**: Suppose \( v \) has \( k \) children \( v_1, v_2, \ldots, v_k \):
     \[
     x_v + 1 \geq \frac{x_{p_v} + \sum_{i} x_{v_i}}{k+1}
     \]
     - From the inductive hypothesis:
     \[
     x_{v_i} \geq x_v - 2n_{v_i} + 1
     \]
     - Substituting:
     \[
     x_v + 1 \geq \frac{x_{p_v} + \sum_{i} (x_v - 2n_{v_i} + 1)}{k+1} = \frac{x_{p_v} + kx_v - \sum_{i} (2n_{v_i} - 1)}{k+1}
     \]
     - Since \( n_{v_1} + \ldots + n_{v_k} = n_v - 1 \):
     \[
     x_v + 1 \geq \frac{x_{p_v} + kx_v + k - 2n_v + 2}{k+1}
     \]
     - Simplifying:
     \[
     (k+1)x_v \geq x_{p_v} + kx_v - 2n_v + 1 \implies x_v \geq x_{p_v} - 2n_v + 1
     \]
     - Thus, \( x_{p_v} - x_v \leq 2n_v - 1 \).

7. **Bounding \( M - m \)**:
   - Let the path from \( M \) to \( m \) be \( M_0 = M, M_1, \ldots, M_k = m \).
   - From the claim:
     \[
     x_{M_{i-1}} - x_{M_i} \leq 2n_{M_i} - 1
     \]
   - Summing up:
     \[
     M - m = M_0 - M_k \leq \sum_{i=1}^k (2n_{M_i} - 1)
     \]
   - Since \( n_{M_i} \leq n - i \):
     \[
     M - m \leq \sum_{i=1}^k (2(n-i) + 1) \leq \sum_{i=1}^n (2(n-i) + 1) = (n-1)^2
     \]

8. **Conclusion**:
   - The maximum weight of bamboo Panda can get is \( (n-1)^2 \) kilograms.

The final answer is \( \boxed{ (N-1)^2 } \) kilograms.